...
liquibase.database.Database implementations are the facade LiquiBase Liquibase uses to access the database. They contain methods to execute SqlStatements, as well as to standardize database metadata and smooth out cross-database differences. Even non-"databases" such as Hibernate mapping configurations can be exposed to LiquiBase Liquibase via a Database implementation.
...
The easiest way to create a new liquibase.database.Database implementation is to extend liquibase.database.AbstractDatabase. If you extend AbstractDatabase, you must implement the following methods:
Code Block |
---|
public boolean isCorrectDatabaseImplementation(Connection conn) throws JDBCException
|
Returns true if the database implementation is correct for the given connection.
Code Block |
---|
public String getShortName()
|
Return a short, lowercase description of the database (e.g. "mysql", "oracle"). Used in error messages, "dbms" attribute, database type preconditions, etc.
Code Block |
---|
public String getDefaultDriver(String url)
|
If the given URL is understood by your Database, return a default driver. Used to find the correct JDBC Driver in cases where just a database URL is passed to LiquiBaseLiquibase. If your implementation does not have a driver for the given url, return null.
Code Block |
---|
public abstract DatabaseSnapshot createDatabaseSnapshot(String schema, Set<DiffStatusListener> statusListeners) throws JDBCException
|
Return a liquibase.structure.DatabaseSnapshot implentation for the given schema.
Code Block |
---|
public String getCurrentDateTimeFunction()
|
Return a string that can be used to generate the current date time (e.g. "NOW()", "SYSDATE").
Code Block |
---|
public boolean supportsInitiallyDeferrableColumns()
|
Return true if your database supports deferrable and/or initially deferrable foreign key constraints. Causes changes that add foreign key constraints marked as deferrable to fail validation.
Code Block |
---|
public boolean supportsTablespaces()
|
Return true if your database supports the concept of "tablespaces". Causes changes that specify a tablespace to fail validation.
Code Block |
---|
public DataType getBooleanType()
public DataType getCurrencyType()
public DataType getUUIDType()
public DataType getClobType()
public DataType getBlobType()
public DataType getDateTimeType()
|
...
- Create the class in the package "liquibase.database.ext". LiquiBase Liquibase automatically registers Databases it finds in that package
- Call liquibase.database.DatabaseFactory.getInstance().register(yourDatabase)
...