Class LiquibaseDBUtils

java.lang.Object
de.xima.fc.liquibase.LiquibaseDBUtils

public class LiquibaseDBUtils extends Object
  • Constructor Details

    • LiquibaseDBUtils

      public LiquibaseDBUtils()
  • Method Details

    • 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 use
      tableName - 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 use
      tableName - the name of the table to create
      colNames - the names of the columns to use for this table
      colType - 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 for
      tableName - 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 use
      tableName - the name of the table to check for the foreign key
      foreignKey - 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

      public static String getForeignKeyName(String tableName)
    • getPrimaryKeyName

      public static String getPrimaryKeyName(String tableName)