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 Details

    • 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 true in a boolean column.
    • getBooleanFalse

      String getBooleanFalse()
      Returns:
      The representation of the value false in 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:
      true if this database uses a catalog to represent a schema, or false if a schema is simply a schema.
    • unQuote

      String unQuote(String identifier)
    • 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.
    • getRawCreateScript

      String getRawCreateScript(Table<?,?> table, boolean baseline)
    • getInsertStatement

      String getInsertStatement(Table<?,?> table)
    • getBaselineStatement

      String getBaselineStatement(Table<?,?> table)
    • getSelectStatement

      String getSelectStatement(Table<?,?> table)
    • 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:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable