Class MigrationConfig

java.lang.Object
io.ebean.migration.MigrationConfig

public class MigrationConfig extends Object
Configuration used to run the migration.
  • Constructor Details

    • MigrationConfig

      public MigrationConfig()
  • Method Details

    • getMetaTable

      public String getMetaTable()
      Return the name of the migration table.
    • setMetaTable

      public void setMetaTable(String metaTable)
      Set the name of the migration table.
    • isAllowErrorInRepeatable

      public boolean isAllowErrorInRepeatable()
      Return true if we continue running the migration when a repeatable migration fails.
    • setAllowErrorInRepeatable

      public void setAllowErrorInRepeatable(boolean allowErrorInRepeatable)
      Set to true to continue running the migration when a repeatable migration fails.
    • setPatchResetChecksumOn

      public void setPatchResetChecksumOn(String versionsCommaDelimited)
      Set the migrations that should have their checksum reset as a comma delimited list.
    • setPatchResetChecksumOn

      public void setPatchResetChecksumOn(Set<String> patchResetChecksumOn)
      Set the migrations that should have their checksum reset.
    • getPatchResetChecksumOn

      public Set<String> getPatchResetChecksumOn()
      Return the migrations that should have their checksum reset.
    • setPatchInsertOn

      public void setPatchInsertOn(String versionsCommaDelimited)
      Set the migrations that should not be run but inserted into history as if they have run.
    • setPatchInsertOn

      public void setPatchInsertOn(Set<String> patchInsertOn)
      Set the migrations that should not be run but inserted into history as if they have run.

      This can be useful when we need to pull out DDL from a repeatable migration that should really only run once. We can pull out that DDL as a new migration and add it to history as if it had been run (we can only do this when we know it exists in all environments including production).

    • getPatchInsertOn

      public Set<String> getPatchInsertOn()
      Return the migrations that should not be run but inserted into history as if they have run.
    • isSkipMigrationRun

      public boolean isSkipMigrationRun()
      Return true if the migration should NOT execute the migrations but update the migration table.

      This can be used to migrate from Flyway where all existing migrations are treated as being executed.

    • setSkipMigrationRun

      public void setSkipMigrationRun(boolean skipMigrationRun)
      Set to true if the migration should NOT execute the migrations but update the migration table only.

      This can be used to migrate from Flyway where all existing migrations are treated as being executed.

    • isSkipChecksum

      public boolean isSkipChecksum()
      Return true if checksum check should be skipped (during development).
    • setSkipChecksum

      public void setSkipChecksum(boolean skipChecksum)
      Set to true to skip the checksum check.

      This is intended for use during development only.

    • getRunPlaceholders

      public String getRunPlaceholders()
      Return a Comma and equals delimited key/value placeholders to replace in DDL scripts.
    • setRunPlaceholders

      public void setRunPlaceholders(String runPlaceholders)
      Set a Comma and equals delimited key/value placeholders to replace in DDL scripts.
    • getRunPlaceholderMap

      public Map<String,String> getRunPlaceholderMap()
      Return a map of name/value pairs that can be expressions replaced in migration scripts.
    • setRunPlaceholderMap

      public void setRunPlaceholderMap(Map<String,String> runPlaceholderMap)
      Set a map of name/value pairs that can be expressions replaced in migration scripts.
    • getMigrationPath

      public String getMigrationPath()
      Return the root path used to find migrations.
    • setMigrationPath

      public void setMigrationPath(String migrationPath)
      Set the root path used to find migrations.
    • getMigrationInitPath

      public String getMigrationInitPath()
      Return the path for containing init migration scripts.
    • setMigrationInitPath

      public void setMigrationInitPath(String migrationInitPath)
      Set the path containing init migration scripts.
    • getDbUsername

      public String getDbUsername()
      Return the DB username.

      Used when a Connection to run the migration is not supplied.

    • setDbUsername

      public void setDbUsername(String dbUsername)
      Set the DB username.

      Used when a Connection to run the migration is not supplied.

    • getDbPassword

      public String getDbPassword()
      Return the DB password.

      Used when creating a Connection to run the migration.

    • setDbPassword

      public void setDbPassword(String dbPassword)
      Set the DB password.

      Used when creating a Connection to run the migration.

    • setDbDriver

      @Deprecated public void setDbDriver(String dbDriver)
      Deprecated.
      Deprecated - not required.

      Used when creating a Connection to run the migration.

    • getDbUrl

      public String getDbUrl()
      Return the DB connection URL.

      Used when creating a Connection to run the migration.

    • setDbUrl

      public void setDbUrl(String dbUrl)
      Set the DB connection URL.

      Used when creating a Connection to run the migration.

    • getDbSchema

      public String getDbSchema()
      Return the DB connection Schema.

      Used when creating a Connection to run the migration.

    • setDbSchema

      public void setDbSchema(String dbSchema)
      Set the DB connection Schema.

      Used when creating a Connection to run the migration.

    • isCreateSchemaIfNotExists

      public boolean isCreateSchemaIfNotExists()
      Return true if migration should create the schema if it does not exist.
    • setCreateSchemaIfNotExists

      public void setCreateSchemaIfNotExists(boolean createSchemaIfNotExists)
      Set to create Schema if it does not exist.
    • isSetCurrentSchema

      public boolean isSetCurrentSchema()
      Return true if the dbSchema should be set as current schema.
    • setSetCurrentSchema

      public void setSetCurrentSchema(boolean setCurrentSchema)
      Set if the dbSchema should be set as current schema.

      We want to set this to false for the case of Postgres where the dbSchema matches the DB username. If we set the dbSchema that can mess up the Postgres search path so we turn this off in that case.

    • getPlatformName

      @Deprecated public String getPlatformName()
      Deprecated.
      Deprecated migrate to getPlatform()
    • setPlatformName

      @Deprecated public void setPlatformName(String platformName)
      Deprecated.
      Deprecated migrate to setPlatform(String).
    • getClassLoader

      public ClassLoader getClassLoader()
      Return the ClassLoader to use to load resources.
    • setClassLoader

      public void setClassLoader(ClassLoader classLoader)
      Set the ClassLoader to use when loading resources.
    • getJdbcMigrationFactory

      public JdbcMigrationFactory getJdbcMigrationFactory()
      Return the jdbcMigrationFactory.
    • setJdbcMigrationFactory

      public void setJdbcMigrationFactory(JdbcMigrationFactory jdbcMigrationFactory)
      Set the jdbcMigrationFactory.
    • getMinVersion

      public String getMinVersion()
      Return the minVersion.
    • setMinVersion

      public void setMinVersion(String minVersion)
      Set the minVersion.
    • getMinVersionFailMessage

      public String getMinVersionFailMessage()
      Return the optional minVersionFailMessage.
    • setMinVersionFailMessage

      public void setMinVersionFailMessage(String minVersionFailMessage)
      Set the minVersionFailMessage
    • load

      public void load(Properties props)
      Load configuration from standard properties.
    • createConnection

      public Connection createConnection()
      Create a Connection to the database using the configured driver, url, username etc.

      Used when an existing DataSource or Connection is not supplied.

    • setName

      public void setName(String name)
      Set the name of the database to run the migration for.

      This name is used when loading properties like: ebean.${name}.migration.migrationPath

    • getBasePlatform

      public String getBasePlatform()
      Return the base platform that was set.
    • setBasePlatform

      public void setBasePlatform(String basePlatform)
      Set the base platform.
    • getPlatform

      public String getPlatform()
      Return the platform that was set.
    • setPlatform

      public void setPlatform(String platform)
      Set the platform that is running the migration.

      This helps for platform specific create table and select for update syntax.

    • isEarlyChecksumMode

      public boolean isEarlyChecksumMode()
      Return true if using the earlyChecksumMode which means checksums are computed before any expressions in the scripts are translated.
    • setEarlyChecksumMode

      public void setEarlyChecksumMode(boolean earlyChecksumMode)
      Set to true to turn on earlyChecksumMode.
    • isFastMode

      public boolean isFastMode()
      Return true if fastMode is turned on.
    • setFastMode

      public void setFastMode(boolean fastMode)
      Set true to enable fastMode. This will perform an initial check for the exact same number of migrations and matching checksums without any locking. If anything does not match then the normal migration is performed with appropriate locking etc.