Hi Keith,

You'll need to update the foreign key constraint.  My bet is that it's named 
"$1" right now, but it needs to be named "metadatavalue_item_id_fkey".

I think the SQL would be

"alter table metadatavalue drop constraint '$1';"

followed by

"alter table metadatavalue add constraint '$metadatavalue_item_id_fkey' foreign 
key ('item_id') references item ('item_id') on delete no action on update no 
action;"

But you'll really want to make a backup first!

I think some of us with databases dating back to the early days have auto-named 
constraints, and they're breaking the flyway stuff.

B--



From: Keith Jones [mailto:mad...@udel.edu]
Sent: Tuesday, March 17, 2015 12:56 PM
To: dspace-tech@lists.sourceforge.net
Subject: [Dspace-tech] Flyway Migration Error

Hi All,

I'm currently attempting to upgrade from dspace version 3.2 to dspace version 
5.1 but I'm getting a java.sql.SQLException which is leading to a black page:

Here's what I have installed

OS : Solaris
Java: 1.7.0_11
Maven: 3.2.3
Ant: 1.8.2
Postgres: 9.4
Tomcat: 7.0.34

I'm able to both build and compile without error, I've deployed both xmlui and 
solr into the webapps area.

Here is the error I'm getting in the logfile:

2015-03-17 14:03:48,848 ERROR org.dspace.storage.rdbms.DatabaseManager @ SQL 
getDataSource Error -
java.sql.SQLException: Flyway migration error occurred
        at 
org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:430)
        at 
org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:338)
        at 
org.dspace.storage.rdbms.DatabaseManager.initialize(DatabaseManager.java:1373)
        at 
org.dspace.storage.rdbms.DatabaseManager.getDataSource(DatabaseManager.java:650)
        at 
org.dspace.storage.rdbms.DatabaseManager.getConnection(DatabaseManager.java:629)
        at org.dspace.core.Context.init(Context.java:121)
        at org.dspace.core.Context.<init>(Context.java:95)
        at org.dspace.browse.IndexBrowse.main(IndexBrowse.java:637)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at 
org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:225)
        at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:77)
Caused by: org.flywaydb.core.api.FlywayException: Migration failed !
        at 
org.flywaydb.core.internal.resolver.jdbc.JdbcMigrationExecutor.execute(JdbcMigrationExecuto
r.java:47)
        at 
org.flywaydb.core.internal.command.DbMigrate$5.doInTransaction(DbMigrate.java:287)
        at 
org.flywaydb.core.internal.command.DbMigrate$5.doInTransaction(DbMigrate.java:285)
        at 
org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:7
2)
        at 
org.flywaydb.core.internal.command.DbMigrate.applyMigration(DbMigrate.java:285)
        at 
org.flywaydb.core.internal.command.DbMigrate.access$800(DbMigrate.java:46)
        at 
org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:207)
        at 
org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:156)
        at 
org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:7
2)
        at 
org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:156)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:864)
        at org.flywaydb.core.Flyway$1.execute(Flyway.java:811)
        at org.flywaydb.core.Flyway.execute(Flyway.java:1171)
        at org.flywaydb.core.Flyway.migrate(Flyway.java:811)
        at 
org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:419)
        ... 13 more
Caused by: org.postgresql.util.PSQLException: ERROR: constraint 
"metadatavalue_item_id_fkey" of relati
on "metadatavalue" does not exist
        at 
org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
        at 
org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
        at 
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:38
8)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:381)
        at 
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.jav
a:172)
        at 
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.jav
a:172)
        at 
org.apache.commons.dbcp.DelegatingPreparedStatement.execute(DelegatingPreparedStatement.jav
a:172)
        at 
org.dspace.storage.rdbms.MigrationUtils.dropDBConstraint(MigrationUtils.java:106)
        at 
org.dspace.storage.rdbms.migration.V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_c
onstraint.migrate(V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint.java:61)
        at 
org.flywaydb.core.internal.resolver.jdbc.JdbcMigrationExecutor.execute(JdbcMigrationExecuto
r.java:45)
        ... 27 more


Thanks
Keith
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
DSpace-tech mailing list
DSpace-tech@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to