Class MigrationSet
java.lang.Object
com.codename1.migration.MigrationSet
A named group of migrations with its own history table.
An application has one, called default, which the build fills from the migration files in
the project. A library that needs tables of its own registers a second set under its own name
and history table, so its versions never collide with the application's.
MigrationSet set = MigrationSet.builder("default")
.sql("1", "create notes", "CREATE TABLE notes (id INTEGER PRIMARY KEY, body TEXT)")
.sql("2", "add created", "ALTER TABLE notes ADD COLUMN created INTEGER")
.build();
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCollects the migrations of a set. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic MigrationSet.BuilderStarts a set.getName()The name of the set.getTable()The history table of the set.booleanWhether this is the application's own set.static booleanWhethereventis one of the events ofMigrationCallback.
-
Field Details
-
DEFAULT_NAME
-
DEFAULT_TABLE
-
-
Method Details
-
isEvent
Whethereventis one of the events ofMigrationCallback.- Parameters:
event- a name such asbeforeMigrate- Returns:
- true when a callback can run on it
-
builder
Starts a set.- Parameters:
name-defaultfor the application's own migrations, otherwise a short lower-case identifier naming the library- Returns:
- a builder
-
getName
-
getTable
The history table of the set.- Returns:
flyway_schema_historyfor the default set andcn1_<name>_schema_historyfor any other, unless the builder named one
-
isDefault
public boolean isDefault()Whether this is the application's own set.- Returns:
- true for the set called
default
-