Interface Database<C extends Connection<?>>
-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Implementing Classes:
BaseDatabase,BigQueryDatabase,CockroachDBDatabase,DB2Database,DerbyDatabase,FirebirdDatabase,H2Database,HSQLDBDatabase,IgniteThinDatabase,InformixDatabase,MariaDBDatabase,MySQLDatabase,OracleDatabase,PostgreSQLDatabase,RedshiftDatabase,SAPHANADatabase,SnowflakeDatabase,SpannerDatabase,SQLiteDatabase,SQLServerDatabase,SybaseASEDatabase,SynapseDatabase,TiDBDatabase,YugabyteDBDatabase
public interface Database<C extends Connection<?>> extends Closeable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancatalogIsSchema()voidcleanPostSchemas(Schema<?,?>[] schemas)Cleans all the objects in this database that need to be cleaned after each schema.voidcleanPreSchemas()Cleans all the objects in this database that need to be cleaned before each schema.voidclose()voidensureSupported()Ensure MigrateDB supports this version of this database.Schema<?,?>[]getAllSchemas()StringgetBaselineStatement(Table<?,?> table)StringgetBooleanFalse()StringgetBooleanTrue()StringgetCatalog()SqlScriptgetCreateScript(SqlScriptFactory sqlScriptFactory, Table<?,?> table, boolean baseline)Retrieves the script used to create the schema history table.StringgetCurrentUser()DatabaseTypegetDatabaseType()DelimitergetDefaultDelimiter()StringgetInsertStatement(Table<?,?> table)StringgetInstalledBy()DatabaseMetaDatagetJdbcMetaData()CgetMainConnection()CgetMigrationConnection()StringgetRawCreateScript(Table<?,?> table, boolean baseline)StringgetSelectStatement(Table<?,?> table)VersiongetVersion()Stringquote(String... identifiers)Quotes these identifiers for use in SQL queries.booleansupportsChangingCurrentSchema()booleansupportsDdlTransactions()booleansupportsEmptyMigrationDescription()booleansupportsMultiStatementTransactions()StringunQuote(String identifier)booleanuseSingleConnection()
-
-
-
Method Detail
-
ensureSupported
void ensureSupported()
Ensure MigrateDB supports this version of this database.
-
getVersion
Version getVersion()
- Returns:
- The 'major.minor' version of this database.
-
getDefaultDelimiter
Delimiter getDefaultDelimiter()
-
getCatalog
String getCatalog()
- Returns:
- The name of the database, by default as determined by JDBC.
-
getCurrentUser
String getCurrentUser()
-
supportsDdlTransactions
boolean supportsDdlTransactions()
-
supportsChangingCurrentSchema
boolean supportsChangingCurrentSchema()
-
getBooleanTrue
String getBooleanTrue()
- Returns:
- The representation of the value
truein a boolean column.
-
getBooleanFalse
String getBooleanFalse()
- Returns:
- The representation of the value
falsein a boolean column.
-
quote
String quote(String... identifiers)
Quotes these identifiers for use in SQL queries. Multiple identifiers will be quoted and separated by a dot.
-
catalogIsSchema
boolean catalogIsSchema()
- Returns:
trueif this database uses a catalog to represent a schema, orfalseif a schema is simply a schema.
-
useSingleConnection
boolean useSingleConnection()
- Returns:
- Whether to use a single connection for both schema history table management and applying migrations.
-
getJdbcMetaData
DatabaseMetaData getJdbcMetaData()
-
getMainConnection
C getMainConnection()
- Returns:
- The main connection used to manipulate the schema history.
-
getMigrationConnection
C getMigrationConnection()
- Returns:
- The migration connection used to apply migrations.
-
getCreateScript
SqlScript getCreateScript(SqlScriptFactory sqlScriptFactory, Table<?,?> table, boolean baseline)
Retrieves the script used to create the schema history table.- Parameters:
sqlScriptFactory- The factory used to create the SQL script.table- The table to create.baseline- Whether to include the creation of a baseline marker.
-
getInstalledBy
String getInstalledBy()
-
getDatabaseType
DatabaseType getDatabaseType()
-
supportsEmptyMigrationDescription
boolean supportsEmptyMigrationDescription()
-
supportsMultiStatementTransactions
boolean supportsMultiStatementTransactions()
-
cleanPreSchemas
void cleanPreSchemas()
Cleans all the objects in this database that need to be cleaned before each schema.
-
cleanPostSchemas
void cleanPostSchemas(Schema<?,?>[] schemas)
Cleans all the objects in this database that need to be cleaned after each schema.- Parameters:
schemas- The list of schemas managed by MigrateDB.
-
getAllSchemas
Schema<?,?>[] getAllSchemas()
-
close
void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
-