Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.
public final class MigrationSet
- Object
- 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 types
class MigrationSet.Builder | Collects the migrations of a set. |
Fields
public static final String DEFAULT_NAME = "default" | The name of the application’s own set. |
public static final String DEFAULT_TABLE = "flyway_schema_history" | The history table of the application’s own set. |
Methods
public static MigrationSet.Builder builder(String name) | Starts a set. |
public String getName() | The name of the set. |
public String getTable() | The history table of the set. |
public boolean isDefault() | Whether this is the application’s own set. |
Inherited methods
Field details
DEFAULT_NAME
public static final String DEFAULT_NAME = "default"The name of the application’s own set.
DEFAULT_TABLE
public static final String DEFAULT_TABLE = "flyway_schema_history"The history table of the application’s own set.
Method details
builder
public static MigrationSet.Builder builder(String name)Starts a set.
Parameters
nameStringdefaultfor the application’s own migrations, otherwise a short lower-case identifier naming the library
Returns
a builder
getName
public String getName()The name of the set.
Returns
the name it was built with
getTable
public String getTable()The history table of the set.
Returns
flyway_schema_history for the default set and cn1_<name>_schema_history for
any other, unless the builder named oneisDefault
public boolean isDefault()Whether this is the application’s own set.
Returns
true for the set called
default