Class PostgreSQLCryptoChecker

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

    public class PostgreSQLCryptoChecker
    extends Object
    implements org.flywaydb.core.api.callback.FlywayCallback
    This is a FlywayCallback class which automatically verifies that "pgcrypto" is at the proper version before running any database migrations.

    When running PostgreSQL, pgcrypto is REQUIRED by DSpace as it allows UUIDs to be generated.

    During a database "clean", this also de-registers "pgcrypto" proir to the full database clean.

    Author:
    Tim Donohue
    • Constructor Detail

      • PostgreSQLCryptoChecker

        public PostgreSQLCryptoChecker()
    • Method Detail

      • checkPgCrypto

        public void checkPgCrypto​(Connection connection)
        Check for pgcrypto (if needed). Throws an exception if pgcrypto is not installed or needs an upgrade.
        Parameters:
        connection - database connection
      • removePgCrypto

        public void removePgCrypto​(Connection connection)
        Remove pgcrypto (if necessary).

        The pgcrypto extension MUST be removed before a clean or else errors occur. This method checks if it needs to be removed and, if so, removes it.

        Parameters:
        connection - database connection
      • 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