Class DatabaseRegistryUpdater

  • All Implemented Interfaces:
    org.flywaydb.core.api.callback.FlywayCallback

    public class DatabaseRegistryUpdater
    extends Object
    implements org.flywaydb.core.api.callback.FlywayCallback
    This is a FlywayCallback class which automatically updates the Metadata Schema Registry and Bitstream Formats Registries AFTER all Database migrations occur.

    The reason this runs AFTER all migrations is that the RegistryLoader and MetadataImporter now depend on Hibernate and Hibernate cannot be initialized until the Database is fully migrated.

    If a migration needs to use on one or more registry values, there are two options:

    • Create/insert those registry values in the migration itself (via SQL or similar).
    • Alternatively, first check for the existence of the MetadataSchemaRegistry (or similar) before running the migration logic. If the table or fields do not yet exist, you might be able to skip the migration logic entirely. See "DatabaseUtils.tableExists()" and similar methods.
    Author:
    Tim Donohue
    • Constructor Detail

      • DatabaseRegistryUpdater

        public DatabaseRegistryUpdater()
    • Method Detail

      • beforeClean

        public void beforeClean​(Connection connection)
        Specified by:
        beforeClean in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterClean

        public void afterClean​(Connection connection)
        Specified by:
        afterClean in interface org.flywaydb.core.api.callback.FlywayCallback
      • beforeMigrate

        public void beforeMigrate​(Connection connection)
        Specified by:
        beforeMigrate in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterMigrate

        public void afterMigrate​(Connection connection)
        Specified by:
        afterMigrate in interface org.flywaydb.core.api.callback.FlywayCallback
      • beforeEachMigrate

        public void beforeEachMigrate​(Connection connection,
                                      org.flywaydb.core.api.MigrationInfo migrationInfo)
        Specified by:
        beforeEachMigrate in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterEachMigrate

        public void afterEachMigrate​(Connection connection,
                                     org.flywaydb.core.api.MigrationInfo migrationInfo)
        Specified by:
        afterEachMigrate in interface org.flywaydb.core.api.callback.FlywayCallback
      • beforeValidate

        public void beforeValidate​(Connection connection)
        Specified by:
        beforeValidate in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterValidate

        public void afterValidate​(Connection connection)
        Specified by:
        afterValidate in interface org.flywaydb.core.api.callback.FlywayCallback
      • beforeBaseline

        public void beforeBaseline​(Connection connection)
        Specified by:
        beforeBaseline in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterBaseline

        public void afterBaseline​(Connection connection)
        Specified by:
        afterBaseline in interface org.flywaydb.core.api.callback.FlywayCallback
      • beforeRepair

        public void beforeRepair​(Connection connection)
        Specified by:
        beforeRepair in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterRepair

        public void afterRepair​(Connection connection)
        Specified by:
        afterRepair in interface org.flywaydb.core.api.callback.FlywayCallback
      • beforeInfo

        public void beforeInfo​(Connection connection)
        Specified by:
        beforeInfo in interface org.flywaydb.core.api.callback.FlywayCallback
      • afterInfo

        public void afterInfo​(Connection connection)
        Specified by:
        afterInfo in interface org.flywaydb.core.api.callback.FlywayCallback