Package de.xima.fc.liquibase
Class LiquibaseDBUtils
java.lang.Object
de.xima.fc.liquibase.LiquibaseDBUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
createBlobTable
(IEntityContext ec, String tableName, ArrayList<String> colNames) static void
createClobTable
(IEntityContext ec, String tableName, ArrayList<String> colNames) static void
createTable
(IEntityContext ec, String tableName, ArrayList<String> colNames) Deprecated.static void
createTable
(IEntityContext ec, String tableName, ArrayList<String> colNames, String colType) Method to create a table while using the underlying database connection.static void
createTable
(IEntityContext ec, String tableName, ArrayList<String> colNames, String colType, boolean autoIncrement) Deprecated.static void
dropTable
(IEntityContext ec, String tableName) Method to drop a table while using the underlying database connection.static liquibase.sql.Sql[]
getAddForeignKeyConstraintStatement
(liquibase.database.Database db, String tableName) static liquibase.precondition.core.ForeignKeyExistsPrecondition
getForeignKeyExistsPrecondition
(liquibase.database.Database db, String tableName, String foreignKey) Method to create a ForeignKeyExistsPrecondition check if a foreign key existsstatic String
getForeignKeyName
(String tableName) static String
getPrimaryKeyName
(String tableName) static liquibase.precondition.core.TableExistsPrecondition
getTableExistsPrecondition
(liquibase.database.Database db, String tableName) Method to create a TableExistsPrecondition to checks if a table exists.
-
Constructor Details
-
LiquibaseDBUtils
public LiquibaseDBUtils()
-
-
Method Details
-
dropTable
Method to drop a table while using the underlying database connection. In order for the deletion to take place, the system first checks whether the table exists. If the table does not exist a log-entry is being written and processing is aborted.- Parameters:
ec
- the entity context for the database-connection to usetableName
- the name of the table to delete- Throws:
Exception
- on errors while dropping the table
-
createTable
@Deprecated public static void createTable(IEntityContext ec, String tableName, ArrayList<String> colNames) throws Exception Deprecated.- Throws:
Exception
-
createTable
@Deprecated public static void createTable(IEntityContext ec, String tableName, ArrayList<String> colNames, String colType, boolean autoIncrement) throws Exception Deprecated.- Throws:
Exception
-
createBlobTable
public static void createBlobTable(IEntityContext ec, String tableName, ArrayList<String> colNames) throws Exception - Throws:
Exception
-
createClobTable
public static void createClobTable(IEntityContext ec, String tableName, ArrayList<String> colNames) throws Exception - Throws:
Exception
-
createTable
public static void createTable(IEntityContext ec, String tableName, ArrayList<String> colNames, String colType) throws Exception Method to create a table while using the underlying database connection. In order for the table to be created, it is first checked whether the table does not exist. If the table already exists, a log message is displayed and processing is aborted.- Parameters:
ec
- the entity context for the database-connection to usetableName
- the name of the table to createcolNames
- the names of the columns to use for this tablecolType
- the type of the columns to use for this table- Throws:
Exception
-
getTableExistsPrecondition
public static liquibase.precondition.core.TableExistsPrecondition getTableExistsPrecondition(liquibase.database.Database db, String tableName) throws liquibase.exception.DatabaseException Method to create a TableExistsPrecondition to checks if a table exists.- Parameters:
db
- the database to check the table existence fortableName
- the name of the table to check for- Returns:
- TableExistsPrecondition the resulting check
- Throws:
liquibase.exception.DatabaseException
-
getForeignKeyExistsPrecondition
public static liquibase.precondition.core.ForeignKeyExistsPrecondition getForeignKeyExistsPrecondition(liquibase.database.Database db, String tableName, String foreignKey) throws liquibase.exception.DatabaseException Method to create a ForeignKeyExistsPrecondition check if a foreign key exists- Parameters:
db
- the database to usetableName
- the name of the table to check for the foreign keyforeignKey
- the name of the foreign key to check- Returns:
- ForeignKeyExistsPrecondition the resulting check
- Throws:
liquibase.exception.DatabaseException
-
getAddForeignKeyConstraintStatement
public static liquibase.sql.Sql[] getAddForeignKeyConstraintStatement(liquibase.database.Database db, String tableName) -
getForeignKeyName
-
getPrimaryKeyName
-