Hello, The INSERT that seems to be failing is this one: https://github.com/DSpace/DSpace/blob/main/dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql#L44-L52
The purpose of that statement is to migrate Community metadata from the "community" table into the "metadatavalue" table. According to the error message you shared, it's saying that it's trying to insert a "null" value for "metadata_value_id"...which is odd, since that field should be automatically filled out by a database sequence. Could you try running the update-sequences script on your database and then try the migration again? It's possible that'll fix it. Run: './dspace database update-sequences' './dspace database migrate ignored' In the migrate script you may need the "ignored" flag to ensure out-of-order migrations also run. See the Upgrading docs, step 9(c). https://wiki.lyrasis.org/display/DSDOC7x/Upgrading+DSpace Let us know on this list if that helps. Tim On Saturday, September 4, 2021 at 10:01:01 AM UTC-5 [email protected] wrote: > *1.Before run migrate database, I check info version db: * > NOTE: This database is NOT yet initialized for auto-migrations (via > Flyway). > > Your database looks to be compatible with DSpace version 4.0 > All upgrades *after* version 4.0 will be run during the next migration. > > If you'd like to upgrade now, simply run 'dspace database migrate'. > > *2.After run migrate database, I receive this errors :* > Migrating database to latest version... (Check dspace logs for details) > Migration exception: > java.sql.SQLException: Flyway migration error occurred > at > org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:738) > at > org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:632) > at > org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:228) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native > Method) > at > java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.base/java.lang.reflect.Method.invoke(Method.java:566) > at > org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:277) > at > org.dspace.app.launcher.ScriptLauncher.handleScript(ScriptLauncher.java:133) > at > org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:98) > Caused by: > org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: > Migration V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql failed > ---------------------------------------------------------------------- > SQL State : 23502 > Error Code : 0 > Message : ERROR: null value in column "metadata_value_id" violates > not-null constraint > Detail: Failing row contains (null, 1, 27, Các b? s?u t?p sách và tài > li?u t?ng h?p,.., null, 0, null, -1, 4). > Location : > org/dspace/storage/rdbms/sqlmigration/postgres/V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql > > (e:\Dspace_Data\Dspace\file:\E:\Dspace_Data\Dspace\lib\dspace-api-7.0.jar!\org\dspace\storage\rdbms\sqlmigration\postgres\V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql) > Line : 44 > Statement : INSERT INTO metadatavalue (resource_id, resource_type_id, > metadata_field_id, text_value, text_lang, place) > SELECT > community_id AS resource_id, > 4 AS resource_type_id, > (select metadata_field_id from metadatafieldregistry where > metadata_schema_id=(select metadata_schema_id from metadataschemaregistry > where short_id='dc') and element = 'description' and qualifier = > 'abstract') AS metadata_field_id, > short_description AS text_value, > null AS text_lang, > 0 AS place > FROM community where not short_description is null > > at > org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:369) > at > org.flywaydb.core.internal.command.DbMigrate.access$200(DbMigrate.java:54) > at > org.flywaydb.core.internal.command.DbMigrate$3.call(DbMigrate.java:282) > at > org.flywaydb.core.internal.jdbc.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:66) > at > org.flywaydb.core.internal.command.DbMigrate.applyMigrations(DbMigrate.java:279) > at > org.flywaydb.core.internal.command.DbMigrate.migrateGroup(DbMigrate.java:244) > at > org.flywaydb.core.internal.command.DbMigrate.access$100(DbMigrate.java:54) > at > org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:162) > at > org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:159) > at > org.flywaydb.core.internal.database.postgresql.PostgreSQLAdvisoryLockTemplate.execute(PostgreSQLAdvisoryLockTemplate.java:71) > at > org.flywaydb.core.internal.database.postgresql.PostgreSQLConnection.lock(PostgreSQLConnection.java:99) > at > org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory.lock(JdbcTableSchemaHistory.java:140) > at > org.flywaydb.core.internal.command.DbMigrate.migrateAll(DbMigrate.java:159) > at > org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:137) > at org.flywaydb.core.Flyway$1.execute(Flyway.java:206) > at org.flywaydb.core.Flyway$1.execute(Flyway.java:158) > at org.flywaydb.core.Flyway.execute(Flyway.java:527) > at org.flywaydb.core.Flyway.migrate(Flyway.java:158) > at > org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:729) > ... 9 more > Caused by: org.flywaydb.core.internal.sqlscript.FlywaySqlScriptException: > Migration V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql failed > ---------------------------------------------------------------------- > SQL State : 23502 > Error Code : 0 > Message : ERROR: null value in column "metadata_value_id" violates > not-null constraint > Detail: Failing row contains (null, 1, 27, Các b? s?u t?p sách và tài > li?u t?ng h?p,.., null, 0, null, -1, 4). > Location : > org/dspace/storage/rdbms/sqlmigration/postgres/V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql > > (e:\Dspace_Data\Dspace\file:\E:\Dspace_Data\Dspace\lib\dspace-api-7.0.jar!\org\dspace\storage\rdbms\sqlmigration\postgres\V5.0_2014.09.26__DS-1582_Metadata_For_All_Objects.sql) > Line : 44 > Statement : INSERT INTO metadatavalue (resource_id, resource_type_id, > metadata_field_id, text_value, text_lang, place) > SELECT > community_id AS resource_id, > 4 AS resource_type_id, > (select metadata_field_id from metadatafieldregistry where > metadata_schema_id=(select metadata_schema_id from metadataschemaregistry > where short_id='dc') and element = 'description' and qualifier = > 'abstract') AS metadata_field_id, > short_description AS text_value, > null AS text_lang, > 0 AS place > FROM community where not short_description is null > > at > org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.handleException(DefaultSqlScriptExecutor.java:275) > at > org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:220) > at > org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.execute(DefaultSqlScriptExecutor.java:127) > at > org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.executeOnce(SqlMigrationExecutor.java:88) > at > org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.access$000(SqlMigrationExecutor.java:33) > at > org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor$1.call(SqlMigrationExecutor.java:77) > at > org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor$1.call(SqlMigrationExecutor.java:74) > at > org.flywaydb.core.internal.database.DefaultExecutionStrategy.execute(DefaultExecutionStrategy.java:28) > at > org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:74) > at > org.flywaydb.core.internal.command.DbMigrate.doMigrateGroup(DbMigrate.java:366) > ... 27 more > Caused by: org.postgresql.util.PSQLException: ERROR: null value in column > "metadata_value_id" violates not-null constraint > Detail: Failing row contains (null, 1, 27, Các b? s?u t?p sách và tài > li?u t?ng h?p,.., null, 0, null, -1, 4). > at > org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2505) > at > org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2241) > at > org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:310) > at > org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:447) > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:368) > at > org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:309) > at > org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:295) > at > org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:272) > at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:267) > at > org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194) > at > org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194) > at > org.flywaydb.core.internal.jdbc.JdbcTemplate.executeStatement(JdbcTemplate.java:244) > at > org.flywaydb.core.internal.sqlscript.ParsedSqlStatement.execute(ParsedSqlStatement.java:111) > at > org.flywaydb.core.internal.sqlscript.DefaultSqlScriptExecutor.executeStatement(DefaultSqlScriptExecutor.java:208) > ... 35 more > *3. And check db info again:* > Database Type: postgres > Database URL: jdbc:postgresql://localhost:5432/SOKHCNLD > Database Schema: public > Database Username: dspace > Database Software: PostgreSQL version 11.13 > Database Driver: PostgreSQL JDBC Driver version 42.2.9 > PostgreSQL 'pgcrypto' extension installed/up-to-date? true (version=1.3) > FlywayDB Version: 6.5.5 > > > +-----------+----------------+-----------------------------------------------------+----------+---------------------+----------------+ > | Category | Version | Description > | Type | Installed On | State | > > +-----------+----------------+-----------------------------------------------------+----------+---------------------+----------------+ > | Versioned | 1.1 | Initial DSpace 1.1 database schema > | SQL | | Below Baseline | > | Versioned | 1.2 | Upgrade to DSpace 1.2 schema > | SQL | | Below Baseline | > | Versioned | 1.3 | Upgrade to DSpace 1.3 schema > | SQL | | Below Baseline | > | Versioned | 1.3.9 | Drop constraint for DSpace 1 4 schema > | JDBC | | Below Baseline | > | Versioned | 1.4 | Upgrade to DSpace 1.4 schema > | SQL | | Below Baseline | > | Versioned | 1.5 | Upgrade to DSpace 1.5 schema > | SQL | | Below Baseline | > | Versioned | 1.5.9 | Drop constraint for DSpace 1 6 schema > | JDBC | | Below Baseline | > | Versioned | 1.6 | Upgrade to DSpace 1.6 schema > | SQL | | Below Baseline | > | Versioned | 1.7 | Upgrade to DSpace 1.7 schema > | SQL | | Below Baseline | > | Versioned | 1.8 | Upgrade to DSpace 1.8 schema > | SQL | | Below Baseline | > | Versioned | 3.0 | Upgrade to DSpace 3.x schema > | SQL | | Below Baseline | > | | 4.0 | Initializing from DSpace 4.0 database > schema | BASELINE | 2021-09-04 20:53:33 | Baseline | > | Versioned | 4.9.2015.10.26 | DS-2818 registry update > | SQL | 2021-09-04 20:53:33 | Success | > | Versioned | 5.0.2014.08.08 | DS-1945 Helpdesk Request a Copy > | SQL | 2021-09-04 20:53:33 | Success | > | Versioned | 5.0.2014.09.25 | DS 1582 Metadata For All Objects drop > constraint | JDBC | 2021-09-04 20:53:33 | Success | > | Versioned | 5.0.2014.09.26 | DS-1582 Metadata For All Objects > | SQL | | Pending | > | Versioned | 5.0.2014.11.04 | Enable XMLWorkflow Migration > | JDBC | | Pending | > | Versioned | 5.6.2016.08.23 | DS-3097 > | SQL | | Pending | > | Versioned | 5.7.2017.04.11 | DS-3563 Index metadatavalue resource type > id column | SQL | | Pending | > > I try find value null in column "metadata_value_id" but don't see any > value null, i fall into a deadlock, hope someone can help me, thank so much > :) > -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/dspace-tech/089c3895-078e-4f5a-a0cf-b19a850724f6n%40googlegroups.com.
