Class BaseDatabase

    • Field Detail

      • rawMainJdbcConnection

        protected final Connection rawMainJdbcConnection
        The main JDBC connection, without any wrapping.
    • Method Detail

      • doGetSession

        protected abstract Session doGetSession​(Connection connection)
        Retrieves a MigrateDB session for this JDBC connection.
      • getVersion

        public final Version getVersion()
        Specified by:
        getVersion in interface Database
        Returns:
        The 'major.minor' version of this database.
      • ensureDatabaseIsRecentEnough

        protected final void ensureDatabaseIsRecentEnough​(String oldestSupportedVersion)
      • recommendMigrateDbUpgradeIfNecessary

        protected final void recommendMigrateDbUpgradeIfNecessary​(String newestSupportedVersion)
      • recommendMigrateDbUpgradeIfNecessaryForMajorVersion

        protected final void recommendMigrateDbUpgradeIfNecessaryForMajorVersion​(String newestSupportedVersion)
      • computeVersionDisplayName

        protected String computeVersionDisplayName​(Version version)
        Compute the user-friendly display name for this database version.
      • getCatalog

        public final String getCatalog()
        Specified by:
        getCatalog in interface Database
        Returns:
        The name of the database, by default as determined by JDBC.
      • quote

        public final String quote​(String... identifiers)
        Description copied from interface: Database
        Quotes these identifiers for use in SQL queries. Multiple identifiers will be quoted and separated by a dot.
        Specified by:
        quote in interface Database
      • doQuote

        protected String doQuote​(String identifier)
        Quotes this identifier for use in SQL queries.
      • getOpenQuote

        protected String getOpenQuote()
      • getCloseQuote

        protected String getCloseQuote()
      • getEscapedQuote

        protected String getEscapedQuote()
      • usesSingleSession

        public boolean usesSingleSession()
        Specified by:
        usesSingleSession in interface Database
        Returns:
        Whether a single session is used for both schema history table management and applying migrations.
      • getMainSession

        public Session getMainSession()
        Specified by:
        getMainSession in interface Database
        Returns:
        The main session used to manipulate the schema history.
      • getMigrationSession

        public Session getMigrationSession()
        Specified by:
        getMigrationSession in interface Database
        Returns:
        The migration session used to apply migrations.
      • determineVersion

        protected Version determineVersion()
        Returns:
        The major and minor version of the database.
      • getCreateScript

        public final SqlScript getCreateScript​(SqlScriptFactory sqlScriptFactory,
                                               Table table,
                                               boolean baseline)
        Description copied from interface: Database
        Retrieves the script used to create the schema history table.
        Specified by:
        getCreateScript in interface Database
        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.