Interface SchemaRevisionManager
-
- All Implemented Interfaces:
-
pro.fessional.wings.faceless.flywave.InteractiveManager
public interface SchemaRevisionManager implements InteractiveManager<SchemaRevisionManager.AskType>
- Since:
2019-06-14
trydofor
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classSchemaRevisionManager.RevisionSqlpublic enumSchemaRevisionManager.AskTypepublic enumSchemaRevisionManager.Status
-
Method Summary
Modifier and Type Method Description abstract Map<String, Long>currentRevision()Get name and revision of each datasource abstract Map<String, SortedMap<Long, SchemaRevisionManager.Status>>statusRevisions()Get the revision and its status of each datasource, sorted from lowest to highest. abstract UnitpublishRevision(Long revision, Long commitId)Publish the given revision to the database, possibly cascading upgrades or downgrades. abstract UnitforceApplyBreak(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. abstract UnitcheckAndInitSql(SortedMap<Long, SchemaRevisionManager.RevisionSql> sqls, Long commitId, Boolean updateDiff)Compare the SQL between in local and in database. abstract UnitforceUpdateSql(SchemaRevisionManager.RevisionSql revision, Long commitId)Force to insert/update the local SQL to the management table if inconsistent (do nothing if consistent) abstract UnitforceUpdateSql(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) abstract UnitforceExecuteSql(String text)Force to execute a sql with flywave syntax, but no versioning, no stateful logging and checking. abstract UnitforceExecuteSql(SortedMap<Long, SchemaRevisionManager.RevisionSql> sqls, Boolean isUpto)Force to execute the sqls with flywave syntax, but no versioning, no stateful logging and checking. -
-
Method Detail
-
currentRevision
abstract Map<String, Long> currentRevision()
Get name and revision of each datasource
-
statusRevisions
abstract Map<String, SortedMap<Long, SchemaRevisionManager.Status>> statusRevisions()
Get the revision and its status of each datasource, sorted from lowest to highest.
nullmeans uninitialized.
-
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
APPLYand the end point must NOT beAPPLY. When downgrading, the start point and the end points must beAPPLY, 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
-
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 JournalisUpto- upto or undo, default upto(true).dataSource- name of datasource to execute,nullmeans 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_SCHEMArevision. If it does not exist, then save local to database. If it exists but the contents are not the same and has beenAPPLYthen log error, otherwise update it.- Parameters:
sqls- sql in localcommitId- commit id of JournalupdateDiff- 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 sqlcommitId- 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- revisionupto- upgrade sql textundo- downgrade sql textcommitId- 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
-
forceExecuteSql
abstract Unit forceExecuteSql(SortedMap<Long, SchemaRevisionManager.RevisionSql> sqls, Boolean isUpto)
Force to execute the sqls with flywave syntax, but no versioning, no stateful logging and checking.
- Parameters:
sqls- sql in localisUpto- upto or undo, default true
-
-
-
-