Class V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint

java.lang.Object
org.flywaydb.core.api.migration.BaseJavaMigration
org.dspace.storage.rdbms.migration.V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint
All Implemented Interfaces:
org.flywaydb.core.api.migration.JavaMigration

public class V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint extends org.flywaydb.core.api.migration.BaseJavaMigration
This class is in support of the DS-1582 Metadata for All Objects feature. It simply drops the database constraint associated with the "item_id" column of the "metadatavalue" table. This is necessary because to support DS-1582 this column must be renamed to "resource_id".

This class was created because the names of database constraints differs based on the type of database (Postgres vs. H2). As such, it becomes difficult to write simple SQL which will work for multiple database types (especially since unit tests require H2 and the syntax for H2 is different from Postgres).

NOTE: This migration class is very simple because it is meant to be used in conjunction with the corresponding SQL script: ./etc/migrations/[db-type]/V5.0_2014_09_26__DS-1582_Metadata_For_All_Objects.sql

Also note that this migration is dated as 2014_09_25 so that it will run just PRIOR to the corresponding SQL script listed above.

This class represents a Flyway DB Java Migration http://flywaydb.org/documentation/migration/java.html

Author:
Tim Donohue
  • Constructor Summary

    Constructors
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the checksum to be associated with this Migration in the Flyway database table (schema_version).
    void
    migrate(org.flywaydb.core.api.migration.Context context)
    Actually migrate the existing database

    Methods inherited from class org.flywaydb.core.api.migration.BaseJavaMigration

    canExecuteInTransaction, extractVersionAndDescription, getDescription, getVersion, init

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.flywaydb.core.api.migration.JavaMigration

    getResolvedMigration, getType
  • Constructor Details

    • V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint

      public V5_0_2014_09_25__DS_1582_Metadata_For_All_Objects_drop_constraint()
  • Method Details

    • migrate

      public void migrate(org.flywaydb.core.api.migration.Context context) throws IOException, SQLException
      Actually migrate the existing database
      Parameters:
      context - Flyway Migration Context
      Throws:
      IOException - A general class of exceptions produced by failed or interrupted I/O operations.
      SQLException - An exception that provides information on a database access error or other errors.
    • getChecksum

      public Integer getChecksum()
      Return the checksum to be associated with this Migration in the Flyway database table (schema_version).
      Specified by:
      getChecksum in interface org.flywaydb.core.api.migration.JavaMigration
      Overrides:
      getChecksum in class org.flywaydb.core.api.migration.BaseJavaMigration
      Returns:
      checksum as an Integer