Package org.dspace.storage.rdbms
Class PostgreSQLCryptoChecker
- java.lang.Object
-
- org.dspace.storage.rdbms.PostgreSQLCryptoChecker
-
- All Implemented Interfaces:
org.flywaydb.core.api.callback.Callback
public class PostgreSQLCryptoChecker extends Object implements org.flywaydb.core.api.callback.Callback
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 Summary
Constructors Constructor Description PostgreSQLCryptoChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanHandleInTransaction(org.flywaydb.core.api.callback.Event event, org.flywaydb.core.api.callback.Context context)Whether event can be handled in a transaction or whether it must be handle outside of transaction.voidcheckPgCrypto(Connection connection)Check for pgcrypto (if needed).voidhandle(org.flywaydb.core.api.callback.Event event, org.flywaydb.core.api.callback.Context context)What to run when the callback is triggered.voidremovePgCrypto(Connection connection)Remove pgcrypto (if necessary).booleansupports(org.flywaydb.core.api.callback.Event event, org.flywaydb.core.api.callback.Context context)Events supported by this callback.
-
-
-
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
-
supports
public boolean supports(org.flywaydb.core.api.callback.Event event, org.flywaydb.core.api.callback.Context context)Events supported by this callback.- Specified by:
supportsin interfaceorg.flywaydb.core.api.callback.Callback- Parameters:
event- Flyway eventcontext- Flyway context- Returns:
- true if BEFORE_BASELINE, BEFORE_MIGRATE or BEFORE_CLEAN
-
canHandleInTransaction
public boolean canHandleInTransaction(org.flywaydb.core.api.callback.Event event, org.flywaydb.core.api.callback.Context context)Whether event can be handled in a transaction or whether it must be handle outside of transaction.- Specified by:
canHandleInTransactionin interfaceorg.flywaydb.core.api.callback.Callback- Parameters:
event- Flyway eventcontext- Flyway context- Returns:
- true
-
handle
public void handle(org.flywaydb.core.api.callback.Event event, org.flywaydb.core.api.callback.Context context)What to run when the callback is triggered.- Specified by:
handlein interfaceorg.flywaydb.core.api.callback.Callback- Parameters:
event- Flyway eventcontext- Flyway context
-
-