Package de.xima.fc.liquibase
Class LiquibaseDBUtils
- java.lang.Object
-
- de.xima.fc.liquibase.LiquibaseDBUtils
-
public class LiquibaseDBUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description LiquibaseDBUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidcreateBlobTable(IEntityContext ec, String tableName, ArrayList<String> colNames)static voidcreateClobTable(IEntityContext ec, String tableName, ArrayList<String> colNames)static voidcreateTable(IEntityContext ec, String tableName, ArrayList<String> colNames)Deprecated.static voidcreateTable(IEntityContext ec, String tableName, ArrayList<String> colNames, String colType)Method to create a table while using the underlying database connection.static voidcreateTable(IEntityContext ec, String tableName, ArrayList<String> colNames, String colType, boolean autoIncrement)Deprecated.static voiddropTable(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.ForeignKeyExistsPreconditiongetForeignKeyExistsPrecondition(liquibase.database.Database db, String tableName, String foreignKey)Method to create a ForeignKeyExistsPrecondition check if a foreign key existsstatic StringgetForeignKeyName(String tableName)static StringgetPrimaryKeyName(String tableName)static liquibase.precondition.core.TableExistsPreconditiongetTableExistsPrecondition(liquibase.database.Database db, String tableName)Method to create a TableExistsPrecondition to checks if a table exists.
-
-
-
Method Detail
-
dropTable
public static void dropTable(IEntityContext ec, String tableName) throws Exception
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.DatabaseExceptionMethod 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.DatabaseExceptionMethod 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)
-
-