Class MigrationSet

java.lang.Object
com.codename1.migration.MigrationSet

public final class MigrationSet extends Object

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();
  • Field Details

  • Method Details

    • builder

      public static MigrationSet.Builder builder(String name)
      Starts a set.
      Parameters:
      name - default for 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 one
    • isDefault

      public boolean isDefault()
      Whether this is the application's own set.
      Returns:
      true for the set called default