Top Description Fields Methods
liquibase.database

public Interface Database

extends PrioritizedService, AutoCloseable
Known Direct Implementers
liquibase.database.core.MockDatabase, liquibase.database.AbstractJdbcDatabase
Imports
liquibase.CatalogAndSchema, liquibase.change.Change, liquibase.changelog.ChangeSet, .DatabaseChangeLog, .RanChangeSet, liquibase.exception.*, liquibase.servicelocator.PrioritizedService, liquibase.sql.visitor.SqlVisitor, liquibase.statement.DatabaseFunction, .SqlStatement, liquibase.structure.DatabaseObject, java.io.IOException, .Writer, java.math.BigInteger, java.util.Collection, .Date, .List, .Locale

Interface that every DBMS supported by this software must implement. Most methods belong into ont of these categories:
  • Information about the capabilities of the DBMS (e.g. can it work with catalogs? with schemas?)
  • changing and manipulating types defined in the SQL standard into native types and vice-versa
  • creating strings for use in SQL statements, e.g. literals for dates, time, numerals, etc.
  • Field Summary

    Modifier and TypeField and Description
    public static final String
    public static final String
    Inherited from liquibase.servicelocator.PrioritizedService:
    COMPARATORPRIORITY_DATABASEPRIORITY_DEFAULT

    Method Summary

    Modifier and TypeMethod and Description
    public void
    public default void
    afterUpdate()

    Allows the database to perform actions after an update is finished, i.

    public void
    close()

    Redeclares java.lang.AutoCloseable.close.

    Closes this resource, relinquishing any underlying resources.

    public void
    public String
    correctObjectName(String name, Class<? extends DatabaseObject> objectType)

    Fix the object name to the format the database expects, handling changes in case, etc.

    public CatalogAndSchema
    correctSchema(CatalogAndSchema schema)

    Returns a new CatalogAndSchema adjusted for this database.

    public boolean
    public boolean

    Returns:

    Whether data type can have a modifier
    dataTypeIsNotModifiable
    (String
    type name
    typeName
    )

    Types like int4 in postgres cannot have a modifier.

    public boolean
    public boolean
    public void
    dropDatabaseObjects(CatalogAndSchema
    schema (catalog+)schema to drop
    schema
    )

    Drops all objects in a specified schema.

    public void
    public String

    Returns:

    escaped column name
    escapeColumnName
    (String catalogName, String schemaName, String tableName, String
    column name
    columnName
    )

    Escapes a single column name in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

    public String
    escapeColumnName(String catalogName, String schemaName, String tableName, String columnName, boolean quoteNamesThatMayBeFunctions)
    Deprecated Know if you should quote the name or not, and use escapeColumnName(String, String, String, String) which will quote things that look like functions, or leave it along as you see fit.

    Similar to escapeColumnName(String, String, String, String) but allows control over whether function-like names should be left unquoted.

    public String

    Returns:

    escaped column name list
    escapeColumnNameList
    (String
    list of column names
    columnNames
    )

    Escapes a list of column names in a database-dependent manner so reserved words can be used as a column name (i.e. "return").

    public String
    escapeConstraintName(String constraintName)

    public String
    escapeDataTypeName(String dataTypeName)

    public String
    escapeIndexName(String catalogName, String schemaName, String indexName)

    public String
    escapeObjectName(String catalogName, String schemaName, String objectName, Class<? extends DatabaseObject> objectType)

    public String
    escapeObjectName(String objectName, Class<? extends DatabaseObject> objectType)

    public String
    escapeSequenceName(String catalogName, String schemaName, String sequenceName)

    public String
    public String
    escapeTableName(String catalogName, String schemaName, String tableName)

    public String
    escapeViewName(String catalogName, String schemaName, String viewName)

    public void
    execute(SqlStatement[] statements, List<SqlVisitor> sqlVisitors)

    public void
    public void
    public void
    executeStatements(Change change, DatabaseChangeLog changeLog, List<SqlVisitor> sqlVisitors)

    public default boolean
    public String

    Returns:

    the string value to use for an update or generate
    generateDatabaseFunctionValue
    (DatabaseFunction
    database function to check.
    databaseFunction
    )

    Some function names are placeholders that need to be replaced with the specific database value.

    public String
    public boolean
    getAutoCommitMode()

    Auto-commit mode to run in

    public String
    getAutoIncrementClause(BigInteger startWith, BigInteger incrementBy, String generationType, Boolean defaultOnNull)

    Returns database-specific auto-increment DDL clause.

    public String
    getConcatSql(String... values)

    Returns SQL to concat the passed values.

    public DatabaseConnection
    public String
    getCurrentDateTimeFunction()

    Returns database-specific function for generating the current date/time.

    public String
    public String
    public int
    public int
    public String
    getDatabaseProductName()

    Returns the name of the database product according to the underlying database.

    public String
    public int
    public List<DatabaseFunction>
    getDateFunctions()

    Returns list of database native date functions

    public String
    public String
    public String
    getDateLiteral(Date defaultDateValue)

    public String
    public String
    public String
    getDefaultDriver(String url)

    If this database understands the given url, return the default driver class name.

    public int

    Returns:

    The default number of fractional digits for TIMESTAMP columns
    getDefaultFractionalDigitsForTimestamp
    ()

    When a TIMESTAMP column without the parameter "number of fractional digits" is created, what is the default value?

    public Integer
    public Integer

    Returns:

    The default precision of the native data type, or null if the type is unknown to this database.
    getDefaultScaleForNativeDataType
    (String
    the name of the native data type (case-insensitive).
    nativeDataType
    )

    Returns the default precision for a given native data type, e.g. "datetime2" for Microsoft SQL Server.

    public CatalogAndSchema
    public String
    public default String

    Returns:

    a properly formatted name of the product. Used for situations where the database is printed to the console. Example: "Snowflake" (note the capitalization)
    getDisplayName
    ()

    public Integer
    public String
    public String
    public String
    public String
    public int

    Returns:

    the number of allowed fractional digits for TIMESTAMP columns. May return 0.
    getMaxFractionalDigitsForTimestamp
    ()

    Determines the maximum precision (number of fractional digits) for TIMESTAMP columns for the given database.

    public ObjectQuotingStrategy
    public boolean
    public boolean

    Returns:

    true (if the schema should be included in every case) or false (omit if default schema)
    getOutputDefaultSchema
    ()

    Should the schema be included in identifiers even if it is the default schema?

    public RanChangeSet
    public List<RanChangeSet>
    getRanChangeSetList()

    Returns the ChangeSets that have been run against the current database.

    public Date
    getRanDate(ChangeSet changeSet)

    public ChangeSet.RunStatus
    getRunStatus(ChangeSet changeSet)

    Returns the run status for the given ChangeSet

    public CatalogAndSchema.CatalogAndSchemaCase
    public String
    getShortName()

    Returns an all-lower-case short name of the product.

    public String
    public String
    public String
    public boolean
    public boolean
    public boolean
    isCorrectDatabaseImplementation(DatabaseConnection conn)

    Is this AbstractDatabase subclass the correct one to use for the given connection.

    public boolean

    Returns:

    if the database supports catalogs: true if it is the default catalog, false if not. If it does not support catalogs, the behaviour of this method is undefined (please call supportsCatalog first!)
    isDefaultCatalog
    (String
    catalog name to be tested
    catalog
    )

    If the database supports catalogs, test if a given catalog name equals to the default catalog of the current logged in user.

    public boolean

    Returns:

    if the database supports catalogs: true if it is the default schema, false if not. If it does not support schemas, the behaviour of this method is undefined (please call supportsSchemas first!)
    isDefaultSchema
    (String
    catalog name to be tested
    catalog
    ,
    String
    schema name to be tested
    schema
    )

    If the database supports schemas, test if a given combination of catalog and schema name equals to the default catalog and schema of the current logged in user.

    public boolean
    public boolean
    public boolean
    public boolean
    public boolean
    public void
    markChangeSetExecStatus(ChangeSet changeSet, ChangeSet.ExecType execType)

    After the changeset has been ran against the database this method will update the change log table with the information.

    public Date
    parseDate(String dateAsString)

    public void
    public boolean

    Returns:

    true if the database behaves incorrectly if NULL is not explicitly specified, false if it behaves like any good RDBMS should.
    requiresExplicitNullForColumns
    ()

    Does the database require explicit NULL for nullable columns?

    public boolean
    public boolean
    public void
    public void
    public void
    saveRollbackStatement(Change change, List<SqlVisitor> sqlVisitors, Writer writer)

    public void
    saveStatements(Change change, List<SqlVisitor> sqlVisitors, Writer writer)

    public void
    setAutoCommit(boolean b)

    public void
    setCanCacheLiquibaseTableInfo(boolean canCacheLiquibaseTableInfo)

    public void
    public void
    public void
    setDatabaseChangeLogLockTableName(String tableName)

    Set the table name of the change log lock to the given table name

    public void
    setDatabaseChangeLogTableName(String
    the name of the change log table to set
    tableName
    )

    Sets the table name of the change log to the given table name.

    public void
    public void
    public void
    public void
    public void
    public void
    public void
    setOutputDefaultCatalog(boolean outputDefaultCatalog)

    public void
    setOutputDefaultSchema(boolean outputDefaultSchema)

    Whether the default schema should be included in generated SQL

    public boolean
    public boolean

    Returns:

    true if the database has this capability for all DML statements, false in all other cases
    supportsBatchUpdates
    ()

    Does the database support batched DML (INSERT/UPDATE/DELETE/MERGE/...) statements sent in a single call to the database?

    public boolean
    public boolean
    public default boolean

    Returns:

    true if the "if not exists" syntax is supported, false otherwise.
    supportsCreateIfNotExists
    (Class<? extends DatabaseObject>
    the DatabaseObject type to be checked.
    type
    )

    Does the database support the "if not exits" syntax?

    public boolean

    Returns:

    True if the database supports DDL within a transaction, otherwise false.
    supportsDDLInTransaction
    ()

    Determines if the database supports DDL within a transaction or not.

    public boolean
    public boolean
    public boolean
    supportsInitiallyDeferrableColumns()

    Returns whether this database support initially deferrable columns.

    public boolean

    Returns:

    true if the database supports naming NOT NULL constraints, false if not.
    supportsNotNullConstraintNames
    ()

    Does this database treat NOT NULL as an own kind of CONSTRAINT (in addition of simply being a column property)?

    public boolean
    public boolean
    public boolean
    public boolean
    public boolean
    public void
    tag(String tagString)

    Tags the database changelog with the given string.

    public String
    public String
    public ValidationErrors
    Inherited from liquibase.servicelocator.PrioritizedService:
    getPriority