core-geonetwork icon indicating copy to clipboard operation
core-geonetwork copied to clipboard

Update from 3.10.8 to 4.10.6 fails, Settings.editable column doesn't exist in GN 4

Open juanluisrp opened this issue 3 years ago • 1 comments

Describe the bug

Using a 3.10.8 database and trying to start GN 4.0.6-SNAPSHOT throws an error while executing the migration scripts. Error is

2021-11-23 11:52:24,642 INFO  [geonetwork.databasemigration] -          - SQL migration WEB-INF/classes/setup/sql/migrate/v3110 prefix:migrate- ...
2021-11-23 11:52:24,670 INFO  [geonetwork.databasemigration] -           Errors occurs during SQL migration file: ERROR: column "editable" of relation "settings" does not exist
  Position: 22
2021-11-23 11:52:24,670 ERROR [geonetwork.databasemigration] - ERROR: column "editable" of relation "settings" does not exist
  Position: 22
org.postgresql.util.PSQLException: ERROR: column "editable" of relation "settings" does not exist
  Position: 22
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2183)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:308)
	at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:307)
	at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:293)
	at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:270)
	at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:266)
	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
	at org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:194)
	at org.fao.geonet.lib.DbLib.runSQL(DbLib.java:166)
	at org.fao.geonet.lib.DbLib.insertData(DbLib.java:88)
	at org.fao.geonet.DatabaseMigration.doMigration(DatabaseMigration.java:228)
	at org.fao.geonet.DatabaseMigration.migrateDatabase(DatabaseMigration.java:148)
	at org.fao.geonet.DatabaseMigration.postProcessAfterInitialization(DatabaseMigration.java:120)

To Reproduce

Steps to reproduce the behavior:

  1. Populate a database with a dump of GN 3.10.8 database.
  2. Start GN 4.0.6-SNAPSHOT using that database

Expected behavior The migration process should finish successfully.

Additional info It looks like this PR (https://github.com/geonetwork/core-geonetwork/pull/5565) has not been added to main branch and the Settings table doesn't have an editable column in that version.

juanluisrp avatar Nov 23 '21 11:11 juanluisrp

regarding #5565 i dont know if the hibernate code/jpa stuff is supposed to add new columns, but i've also encountered this issue migrating from 3.8.2 to 4.0.6.

I ended up manually creating it so that the migration step did some progress:

[db3:5432] geonetwork@geonetwork=> ALTER TABLE Settings ADD COLUMN editable VARCHAR(1) DEFAULT 'y';
ALTER TABLE

but then it failed on other cryptic issues in v3110/UpdateMetadataStatus.java , i'm looking at #6055 & #6058.

landryb avatar Jul 29 '22 12:07 landryb