public class MigrationUtils extends Object
NOTE: This class specifically CANNOT utilize Hibernate, because it is used for database migrations which take place PRIOR to Hibernate loading. However, as you'll see below, all methods are protected to ensure the rest of the API cannot bypass Hibernate.
| Constructor and Description |
|---|
MigrationUtils() |
| Modifier and Type | Method and Description |
|---|---|
protected static Integer |
dropDBConstraint(Connection connection,
String tableName,
String columnName,
String constraintSuffix)
Drop a given Database Constraint (based on the current database type).
|
protected static Integer |
dropDBSequence(Connection connection,
String sequenceName)
Drop a given Database Sequence (based on the current database type).
|
protected static Integer |
dropDBTable(Connection connection,
String tableName)
Drop a given Database Table (based on the current database type).
|
protected static Integer |
dropDBView(Connection connection,
String viewName)
Drop a given Database View (based on the current database type).
|
protected static Integer dropDBConstraint(Connection connection, String tableName, String columnName, String constraintSuffix) throws SQLException
connection - the current Database connectiontableName - the name of the table the constraint applies tocolumnName - the name of the column the constraint applies toconstraintSuffix - Only used for PostgreSQL, whose constraint naming convention depends on a suffix (key, fkey, etc)SQLException - if a database error occursprotected static Integer dropDBTable(Connection connection, String tableName) throws SQLException
NOTE: Ideally, if you need to do a DROP TABLE, you should just create a Flyway SQL migration. This method should ONLY be used if the table name needs to be dynamically determined via Java.
connection - the current Database connectiontableName - the name of the table to dropSQLException - if a database error occursprotected static Integer dropDBSequence(Connection connection, String sequenceName) throws SQLException
NOTE: Ideally, if you need to do a DROP SEQUENCE, you should just create a Flyway SQL migration. This method should ONLY be used if the sequence name needs to be dynamically determined via Java.
connection - the current Database connectionsequenceName - the name of the sequence to dropSQLException - if a database error occursprotected static Integer dropDBView(Connection connection, String viewName) throws SQLException
NOTE: Ideally, if you need to do a DROP VIEW, you should just create a Flyway SQL migration. This method should ONLY be used if the view name needs to be dynamically determined via Java.
connection - the current Database connectionviewName - the name of the view to dropSQLException - if a database error occursCopyright © 2017 DuraSpace. All rights reserved.