The migration still fails.  See below for complete trace:

Database URL: jdbc:postgresql://localhost:5432/dspace
Migrating database to latest version AND running previously "Ignored" 
migrations... (Check logs for details)
Migration exception:
java.sql.SQLException: Flyway migration error occurred
        at 
org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:838)
        at 
org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:725)
        at 
org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:205)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native 
Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at 
org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:283)
        at 
org.dspace.app.launcher.ScriptLauncher.handleScript(ScriptLauncher.java:134)
        at 
org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:99)
Caused by: 
org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: SQL 
State  : null
Error Code : 0
Message    : Flyway executeSql() error occurred

        at 
org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:388)
        at 
org.flywaydb.core.internal.command.DbMigrate.lambda$applyMigrations$1(DbMigrate.java:275)
        at 
org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:55)
        at 
org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:274)
        at 
org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:247)
        at 
org.flywaydb.core.internal.command.DbMigrate.lambda$migrateAll$0(DbMigrate.java:141)
        at 
org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:69)
        at 
org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:99)
        at 
org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:139)
        at 
org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:141)
        at 
org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:98)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:173)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:124)
        at org.flywaydb.core.FlywayExecutor.execute(FlywayExecutor.java:214)
        at org.flywaydb.core.Flyway.migrate(Flyway.java:124)
        at 
org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:825)
        ... 9 more
Caused by: java.sql.SQLException: Flyway executeSql() error occurred
        at 
org.dspace.storage.rdbms.DatabaseUtils.executeSql(DatabaseUtils.java:1253)
        at 
org.dspace.storage.rdbms.migration.V5_7_2017_05_05__DS_3431_Add_Policies_for_BasicWorkflow.migrate(V5_7_2017_05_05__DS_3431_Add_Policies_for_BasicWorkflow.java:43)
        at 
org.flywaydb.core.internal.resolver.java.JavaMigrationExecutor.executeOnce(JavaMigrationExecutor.java:55)
        at 
org.flywaydb.core.internal.resolver.java.JavaMigrationExecutor.lambda$execute$0(JavaMigrationExecutor.java:48)
        at 
org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27)
        at 
org.flywaydb.core.internal.resolver.java.JavaMigrationExecutor.execute(JavaMigrationExecutor.java:47)
        at 
org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:377)
        ... 24 more
Caused by: org.springframework.jdbc.BadSqlGrammarException: 
StatementCallback; bad SQL grammar [--
-- The contents of this file are subject to the license and copyright
-- detailed in the LICENSE and NOTICE files at the root of the source
-- tree and available online at
--
-- http://www.dspace.org/license/
--

-------------------------------------------------------------------------
-- DS-3431 Workflow system is vulnerable to unauthorized manipulations --
-------------------------------------------------------------------------

-----------------------------------------------------------------------
-- grant claiming permissions to all workflow step groups (step 1-3) --
-----------------------------------------------------------------------
INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, epersongroup_id, 
resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '3' AS resource_type_id,
    '5' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    workflow_step_1 AS epersongroup_id,
    collection_id
  FROM collection
  WHERE workflow_step_1 IS NOT NULL
    AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id 
= 5 AND epersongroup_id = workflow_step_1 and resource_id = collection_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, epersongroup_id, 
resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '3' AS resource_type_id,
    '6' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    workflow_step_2 AS epersongroup_id,
    collection_id
  FROM collection
  WHERE workflow_step_2 IS NOT NULL
    AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id 
= 6 AND epersongroup_id = workflow_step_2 and resource_id = collection_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, epersongroup_id, 
resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '3' AS resource_type_id,
    '7' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    workflow_step_3 AS epersongroup_id,
    collection_id
  FROM collection
  WHERE workflow_step_3 IS NOT NULL
    AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id 
= 7 AND epersongroup_id = workflow_step_3 and resource_id = collection_id
    );

-----------------------------------------------------------------------
-- grant add permissions to all workflow step groups (step 1-3) --
-----------------------------------------------------------------------
INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, epersongroup_id, 
resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '3' AS resource_type_id,
    '3' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    workflow_step_1 AS epersongroup_id,
    collection_id
  FROM collection
  WHERE workflow_step_1 IS NOT NULL
        AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id 
= 3 AND epersongroup_id = workflow_step_1 and resource_id = collection_id
  );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, epersongroup_id, 
resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '3' AS resource_type_id,
    '3' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    workflow_step_2 AS epersongroup_id,
    collection_id
  FROM collection
  WHERE workflow_step_2 IS NOT NULL
        AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id 
= 3 AND epersongroup_id = workflow_step_2 and resource_id = collection_id
  );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, epersongroup_id, 
resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '3' AS resource_type_id,
    '3' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    workflow_step_3 AS epersongroup_id,
    collection_id
  FROM collection
  WHERE workflow_step_3 IS NOT NULL
        AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 3 AND action_id 
= 3 AND epersongroup_id = workflow_step_3 and resource_id = collection_id
  );

----------------------------------------------------------------------------------
-- grant read/write/delete/add/remove permission on workflow items to 
reviewers --
----------------------------------------------------------------------------------
INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '2' AS resource_type_id,
    '0' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    owner AS eperson_id,
    item_id
  FROM workflowitem
  WHERE
    owner IS NOT NULL
    AND (state = 2 OR state = 4 OR state = 6)
    AND NOT EXISTS (
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND action_id 
= 0 AND eperson_id = owner AND resource_id = item_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '2' AS resource_type_id,
    '1' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    owner AS eperson_id,
    item_id
  FROM workflowitem
  WHERE
    owner IS NOT NULL
    AND (state = 2 OR state = 4 OR state = 6)
    AND NOT EXISTS (
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND 
action_id = 1 AND eperson_id = owner AND resource_id = item_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '2' AS resource_type_id,
    '2' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    owner AS eperson_id,
    item_id
  FROM workflowitem
  WHERE
    owner IS NOT NULL
    AND (state = 2 OR state = 4 OR state = 6)
    AND NOT EXISTS (
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND 
action_id = 2 AND eperson_id = owner AND resource_id = item_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '2' AS resource_type_id,
    '3' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    owner AS eperson_id,
    item_id
  FROM workflowitem
  WHERE
    owner IS NOT NULL
    AND (state = 2 OR state = 4 OR state = 6)
    AND NOT EXISTS (
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND 
action_id = 3 AND eperson_id = owner AND resource_id = item_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '2' AS resource_type_id,
    '4' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    owner AS eperson_id,
    item_id
  FROM workflowitem
  WHERE
    owner IS NOT NULL
    AND (state = 2 OR state = 4 OR state = 6)
    AND NOT EXISTS (
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 2 AND 
action_id = 4 AND eperson_id = owner AND resource_id = item_id
    );

-----------------------------------------------------------------------------------
-- grant read/write/delete/add/remove permission on Bundle ORIGINAL to 
reviewers --
-----------------------------------------------------------------------------------
INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '1' AS resource_type_id,
    '0' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    i2b.bundle_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
      SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND action_id 
= 0 AND resourcepolicy.eperson_id = owner AND resourcepolicy.resource_id = 
i2b.bundle_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '1' AS resource_type_id,
    '1' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    i2b.bundle_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND 
action_id = 1 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = i2b.bundle_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '1' AS resource_type_id,
    '2' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    i2b.bundle_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND 
action_id = 2 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = i2b.bundle_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '1' AS resource_type_id,
    '3' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    i2b.bundle_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND 
action_id = 3 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = i2b.bundle_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '1' AS resource_type_id,
    '4' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    i2b.bundle_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 1 AND 
action_id = 4 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = i2b.bundle_id
    );


-------------------------------------------------------------------------------
-- grant read/write/delete/add/remove permission on all Bitstreams of 
Bundle --
-- ORIGINAL to reviewers                                                   
  --
-------------------------------------------------------------------------------
INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '0' AS resource_type_id,
    '0' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    b2b.bitstream_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN bundle2bitstream AS b2b
  ON b2b.bundle_id = i2b.bundle_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND 
action_id = 0 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = b2b.bitstream_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '0' AS resource_type_id,
    '1' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    b2b.bitstream_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN bundle2bitstream AS b2b
  ON b2b.bundle_id = i2b.bundle_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND 
action_id = 1 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = b2b.bitstream_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '0' AS resource_type_id,
    '2' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    b2b.bitstream_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN bundle2bitstream AS b2b
  ON b2b.bundle_id = i2b.bundle_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND 
action_id = 2 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = b2b.bitstream_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '0' AS resource_type_id,
    '3' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    b2b.bitstream_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN bundle2bitstream AS b2b
  ON b2b.bundle_id = i2b.bundle_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND 
action_id = 3 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = b2b.bitstream_id
    );

INSERT INTO resourcepolicy
  (policy_id, resource_type_id, action_id, rptype, eperson_id, resource_id)
  SELECT
    nextval('resourcepolicy_seq') AS policy_id,
    '0' AS resource_type_id,
    '4' AS action_id,
    'TYPE_WORKFLOW' AS rptype,
    wfi.owner AS eperson_id,
    b2b.bitstream_id AS dspace_object
  FROM workflowitem AS wfi
  JOIN item2bundle AS i2b
  ON i2b.item_id = wfi.item_id
  JOIN bundle2bitstream AS b2b
  ON b2b.bundle_id = i2b.bundle_id
  JOIN metadatavalue AS mv
  ON mv.resource_id = i2b.bundle_id
  JOIN metadatafieldregistry as mfr
  ON mv.metadata_field_id = mfr.metadata_field_id
  JOIN metadataschemaregistry as msr
  ON mfr.metadata_schema_id = msr.metadata_schema_id
  WHERE
    msr.namespace = 'http://dublincore.org/documents/dcmi-terms/'
    AND mfr.element = 'title'
    AND mfr.qualifier IS NULL
    AND mv.text_value = 'ORIGINAL'
    AND wfi.owner IS NOT NULL
    AND (wfi.state = 2 OR wfi.state = 4 OR wfi.state = 6)
    AND NOT EXISTS(
        SELECT 1 FROM resourcepolicy WHERE resource_type_id = 0 AND 
action_id = 4 AND resourcepolicy.eperson_id = owner AND 
resourcepolicy.resource_id = b2b.bitstream_id
    );
]; nested exception is org.postgresql.util.PSQLException: ERROR: operator 
does not exist: integer = uuid
  Hint: No operator matches the given name and argument types. You might 
need to add explicit type casts.
  Position: 767
        at 
org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:70)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)
        at 
org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:79)
        at 
org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1541)
        at 
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:393)
        at 
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:431)
        at 
org.dspace.storage.rdbms.DatabaseUtils.executeSql(DatabaseUtils.java:1250)
        ... 30 more
Caused by: org.postgresql.util.PSQLException: ERROR: operator does not 
exist: integer = uuid
  Hint: No operator matches the given name and argument types. You might 
need to add explicit type casts.
  Position: 767
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
        at 
org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
        at 
org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:335)
        at 
org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:321)
        at 
org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:297)
        at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:292)
        at 
org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
        at 
org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
        at 
org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:422)
        at 
org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:381)
        ... 32 more

On Tuesday, November 28, 2023 at 10:48:28 AM UTC-5 James Holobetz wrote:

> Hi Steve,
>
> I believe you may have to run:
>
> ./dspace database migrate ignored
>
> as described in 
> https://wiki.lyrasis.org/display/DSDOC7x/Migrating+DSpace+to+a+new+server
>
> James
>
>
>
> On Tue, Nov 28, 2023 at 9:15 AM Steve Michaels <steve.m...@westernsem.edu> 
> wrote:
>
>> When I run "migrate" I'm receiving a relation "cwf_pooltask" does not 
>> exist ERROR.   We have been using the XML workflow, consequently DS 3431 
>> Add Policies for BasicWorkflow is still at version 5.7.2017.05.05.
>>
>> The full last error is:
>> ---------------------------------------------------------------
>> -- DS-4239 Migrate the workflow.xml to spring
>> ---------------------------------------------------------------
>> -- This script will rename the default workflow "default" name
>> -- to the new "defaultWorkflow" identifier
>> ---------------------------------------------------------------
>>
>> UPDATE cwf_pooltask SET workflow_id='defaultWorkflow' WHERE 
>> workflow_id='default'
>>
>>         at 
>> org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:275)
>>         at 
>> org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:222)
>>         at 
>> org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:126)
>>         at 
>> org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:69)
>>         at 
>> org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.lambda$execute$0(SqlMigrationExecutor.java:58)
>>         at 
>> org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:27)
>>         at 
>> org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:57)
>>         at 
>> org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:377)
>>         ... 25 more
>> Caused by: org.postgresql.util.PSQLException: ERROR: relation 
>> "cwf_pooltask" does not exist
>>   Position: 684
>>         at 
>> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2713)
>>         at 
>> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2401)
>>         at 
>> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:368)
>>         at 
>> org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:498)
>>         at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:415)
>>         at 
>> org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:335)
>>         at 
>> org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:321)
>>         at 
>> org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:297)
>>         at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:292)
>>         at 
>> org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
>>         at 
>> org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:193)
>>         at 
>> org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:201)
>>         at 
>> org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:95)
>>         at 
>> org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:210)
>>         ... 31 more
>>
>> -- 
>> All messages to this mailing list should adhere to the Code of Conduct: 
>> https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "DSpace Technical Support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to dspace-tech...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/dspace-tech/91ab8d70-a24e-4bf1-aa5a-5585ce0bd40dn%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/dspace-tech/91ab8d70-a24e-4bf1-aa5a-5585ce0bd40dn%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
All messages to this mailing list should adhere to the Code of Conduct: 
https://www.lyrasis.org/about/Pages/Code-of-Conduct.aspx
--- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dspace-tech/955da2a8-1350-490e-b4ab-ebc68b5876c8n%40googlegroups.com.

Reply via email to