Interface SchemaRevisionManager

    • Constructor Detail

    • Method Detail

      • publishRevision

         abstract Unit publishRevision(Long revision, Long commitId)

        Publish the given revision to the database, possibly cascading upgrades or downgrades. If there is an inconsistency between the start and end points or a breakpoint, write to the log and skip the execution.

        A breakpoint, a discontinuous APPLY state, is an abnormal or inserting state. When upgrading, the start point must be APPLY and the end point must NOT be APPLY. When downgrading, the start point and the end points must be APPLY, ignoring the un-APPLY breakpoints in between.

        Be careful with backup data when downgrading, the data or table may be deleted.

        Parameters:
        revision - To this version, i.e.
        commitId - commit id of Journal
      • bumpingRevision

         abstract Unit bumpingRevision(Long revision, Long commitId)

        Only bump the revision number without executing scripts, used for handling manual execution cases.

      • forceApplyBreak

         abstract Unit forceApplyBreak(Long revision, Long commitId, Boolean isUpto, String dataSource)

        Force to run a breakpoint script (script only, no cascading upgrades or downgrades), usually to fix an abnormal operation.

        Parameters:
        revision - To this version, i.e.
        commitId - commit id of Journal
        isUpto - upto or undo, default upto(true).
        dataSource - name of datasource to execute, null means all
      • checkAndInitSql

         abstract Unit checkAndInitSql(SortedMap<Long, SchemaRevisionManager.RevisionSql> sqls, Long commitId, Boolean updateDiff)

        Compare the SQL between in local and in database. If not initialized, run the REVISION_1ST_SCHEMA revision. If it does not exist, then save local to database. If it exists but the contents are not the same and has been APPLY then log error, otherwise update it.

        Parameters:
        sqls - sql in local
        commitId - commit id of Journal
        updateDiff - Whether to auto update inconsistent sql, default false.
      • forceUpdateSql

         abstract Unit forceUpdateSql(SchemaRevisionManager.RevisionSql revision, Long commitId)

        Force to insert/update the local SQL to the management table if inconsistent (do nothing if consistent)

        Parameters:
        revision - revision sql
        commitId - commit id of Journal
      • forceUpdateSql

         abstract Unit forceUpdateSql(Long revision, String upto, String undo, Long commitId)

        Force to insert/update the local SQL to the management table if inconsistent (do nothing if consistent)

        Parameters:
        revision - revision
        upto - upgrade sql text
        undo - downgrade sql text
        commitId - commit id of Journal
      • forceExecuteSql

         abstract Unit forceExecuteSql(String text)

        Force to execute a sql with flywave syntax, but no versioning, no stateful logging and checking.

        Parameters:
        text - sql text