Hi Anthony,

It sounds like your institution has had a DSpace for a very long time.  The
"collectionitemsby" views were used in the very early versions of DSpace
(1.x), and was removed around version 1.5 (see also:
https://jira.duraspace.org/browse/DS-2678).

So, my best guess here is someone didn't perform a past upgrade properly,
and these views never were actually removed from your database.  Our flyway
upgrade process is likely assuming they were already removed, as it will
identify your DSpace as being version 4.x (and those views didn't exist
even in 4.x).  That's why it's throwing the error you are seeing.

You can safely remove all of those views, as they are no longer used in
DSpace.  After removing the views, re-run the database migration (e.g.
[dspace]/bin/dspace database migrate), and everything should go smoothly.

- Tim


On Mon, Jan 22, 2018 at 3:36 PM Anthony Petryk <[email protected]> wrote:

> Hello,
>
> I'm trying to upgrade from 4.3 to 6.2.  I get the error below when I run
> the "dspace database migrate" command.  I don't know if the views (in bold)
> are supposed to exist or not.
>
> Any help would be appreciated.
>
> Anthony
>
> --
>
> Database URL: jdbc:postgresql://localhost:5432/dspace62
> 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:666)
>         at
> org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:574)
>         at
> org.dspace.storage.rdbms.DatabaseUtils.main(DatabaseUtils.java:222)
>         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:606)
>         at
> org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229)
>         at
> org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)
> Caused by: org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException:
> Migration V6.0_2015.03.07__DS-2701_Hibernate_migration.sql failed
> -----------------------------------------------------------------
> SQL State  : 2BP01
> Error Code : 0
>
>
>
>
>
> *Message    : ERROR: cannot drop table collection2item column
> collection_legacy_id because other objects depend on it  Detail: view
> collectionitemsbyauthor depends on table collection2item column
> collection_legacy_idview collectionitemsbydate depends on table
> collection2item column collection_legacy_idview
> collectionitemsbydateaccession depends on table collection2item column
> collection_legacy_idview collectionitemsbysubject depends on table
> collection2item column collection_legacy_idview collectionitemsbytitle
> depends on table collection2item column collection_legacy_id*
>   Hint: Use DROP ... CASCADE to drop the dependent objects too.
> Location   :
> org/dspace/storage/rdbms/sqlmigration/postgres/V6.0_2015.03.07__DS-2701_Hibernate_migration.sql
> (/opt/dspace/dspace/bin/file:/opt/dspace/dspace/lib/dspace-api-6.3-SNAPSHOT.jar!/org/dspace/storage/rdbms/sqlmigration/postgres/V6.0_2015.03.07__DS-2701_Hibernate_migration.sql)
> Line       : 143
> Statement  : ALTER TABLE Collection2Item DROP COLUMN collection_legacy_id
>
>         at
> org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:117)
>         at
> org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:71)
>         at
> org.flywaydb.core.internal.command.DbMigrate.doMigrate(DbMigrate.java:352)
>         at
> org.flywaydb.core.internal.command.DbMigrate.access$1100(DbMigrate.java:47)
>         at
> org.flywaydb.core.internal.command.DbMigrate$4.doInTransaction(DbMigrate.java:308)
>         at
> org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
>         at
> org.flywaydb.core.internal.command.DbMigrate.applyMigration(DbMigrate.java:305)
>         at
> org.flywaydb.core.internal.command.DbMigrate.access$1000(DbMigrate.java:47)
>         at
> org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:230)
>         at
> org.flywaydb.core.internal.command.DbMigrate$2.doInTransaction(DbMigrate.java:173)
>         at
> org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:72)
>         at
> org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:173)
>         at org.flywaydb.core.Flyway$1.execute(Flyway.java:959)
>         at org.flywaydb.core.Flyway$1.execute(Flyway.java:917)
>         at org.flywaydb.core.Flyway.execute(Flyway.java:1373)
>         at org.flywaydb.core.Flyway.migrate(Flyway.java:917)
>         at
> org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:655)
>         ... 8 more
> Caused by: org.postgresql.util.PSQLException: ERROR: cannot drop table
> collection2item column collection_legacy_id because other objects depend on
> it
>   Detail: view collectionitemsbyauthor depends on table collection2item
> column collection_legacy_id
> view collectionitemsbydate depends on table collection2item column
> collection_legacy_id
> view collectionitemsbydateaccession depends on table collection2item
> column collection_legacy_id
> view collectionitemsbysubject depends on table collection2item column
> collection_legacy_id
> view collectionitemsbytitle depends on table collection2item column
> collection_legacy_id
>   Hint: Use DROP ... CASCADE to drop the dependent objects too.
>         at
> org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2458)
>         at
> org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2158)
>         at
> org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:291)
>         at
> org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:432)
>         at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:358)
>         at
> org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:305)
>         at
> org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:291)
>         at
> org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:269)
>         at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:265)
>         at
> org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:291)
>         at
> org.apache.commons.dbcp2.DelegatingStatement.execute(DelegatingStatement.java:291)
>         at
> org.flywaydb.core.internal.dbsupport.JdbcTemplate.executeStatement(JdbcTemplate.java:238)
>         at
> org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:114)
>         ... 24 more
>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/dspace-tech.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Tim Donohue
Technical Lead for DSpace & DSpaceDirect
DuraSpace.org | DSpace.org | DSpaceDirect.org

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to