Class MigrationConfig
- java.lang.Object
-
- io.ebean.migration.MigrationConfig
-
public class MigrationConfig extends Object
Configuration used to run the migration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classMigrationConfig.DefaultMigrationFactoryDefault factory.
-
Constructor Summary
Constructors Constructor Description MigrationConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectioncreateConnection()Create a Connection to the database using the configured driver, url, username etc.StringgetApplySuffix()Return the suffix for migration resources (defaults to .sql).ClassLoadergetClassLoader()Return the ClassLoader to use to load resources.StringgetDbDriver()Return the DB Driver.StringgetDbPassword()Return the DB password.StringgetDbSchema()Return the DB connection Schema.StringgetDbUrl()Return the DB connection URL.StringgetDbUsername()Return the DB username.JdbcMigrationFactorygetJdbcMigrationFactory()Returns the jdbcMigrationFactory.StringgetMetaTable()Return the name of the migration table.StringgetMigrationInitPath()Return the path for containing init migration scripts.StringgetMigrationPath()Return the root path used to find migrations.StringgetMinVersion()Returns the minVersion.StringgetMinVersionFailMessage()Sets the optional minVersionFailMessage.Set<String>getPatchInsertOn()Return the migrations that should not be run but inserted into history as if they have run.Set<String>getPatchResetChecksumOn()Return the migrations that should have their checksum reset.StringgetPlatformName()Return the DB platform name (used for platform create table and select for update syntax).Map<String,String>getRunPlaceholderMap()Return a map of name/value pairs that can be expressions replaced in migration scripts.StringgetRunPlaceholders()Return a Comma and equals delimited key/value placeholders to replace in DDL scripts.booleanisAllowErrorInRepeatable()Return true if we continue running the migration when a repeatable migration fails.booleanisCreateSchemaIfNotExists()Return true if migration should create the schema if it does not exist.booleanisSetCurrentSchema()Return true if the dbSchema should be set as current schema.booleanisSkipChecksum()Return true if checksum check should be skipped (during development).voidload(Properties props)Load configuration from standard properties.voidsetAllowErrorInRepeatable(boolean allowErrorInRepeatable)Set to true to continue running the migration when a repeatable migration fails.voidsetApplySuffix(String applySuffix)Set the suffix for migration resources.voidsetClassLoader(ClassLoader classLoader)Set the ClassLoader to use when loading resources.voidsetCreateSchemaIfNotExists(boolean createSchemaIfNotExists)Set to create Schema if it does not exist.voidsetDbDriver(String dbDriver)Set the DB Driver.voidsetDbPassword(String dbPassword)Set the DB password.voidsetDbSchema(String dbSchema)Set the DB connection Schema.voidsetDbUrl(String dbUrl)Set the DB connection URL.voidsetDbUsername(String dbUsername)Set the DB username.voidsetJdbcMigrationFactory(JdbcMigrationFactory jdbcMigrationFactory)Sets the jdbcMigrationFactory.voidsetMetaTable(String metaTable)Set the name of the migration table.voidsetMigrationInitPath(String migrationInitPath)Set the path containing init migration scripts.voidsetMigrationPath(String migrationPath)Set the root path used to find migrations.voidsetMinVersion(String minVersion)Set the minVersion.voidsetMinVersionFailMessage(String minVersionFailMessage)voidsetPatchInsertOn(String versionsCommaDelimited)Set the migrations that should not be run but inserted into history as if they have run.voidsetPatchInsertOn(Set<String> patchInsertOn)Set the migrations that should not be run but inserted into history as if they have run.voidsetPatchResetChecksumOn(String versionsCommaDelimited)Set the migrations that should have their checksum reset as a comma delimited list.voidsetPatchResetChecksumOn(Set<String> patchResetChecksumOn)Set the migrations that should have their checksum reset.voidsetPlatformName(String platformName)Set a DB platform name (to load specific create table and select for update syntax).voidsetRunPlaceholderMap(Map<String,String> runPlaceholderMap)Set a map of name/value pairs that can be expressions replaced in migration scripts.voidsetRunPlaceholders(String runPlaceholders)Set a Comma and equals delimited key/value placeholders to replace in DDL scripts.voidsetSetCurrentSchema(boolean setCurrentSchema)Set if the dbSchema should be set as current schema.voidsetSkipChecksum(boolean skipChecksum)Set to true to skip the checksum check.
-
-
-
Constructor Detail
-
MigrationConfig
public MigrationConfig()
-
-
Method Detail
-
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.
-
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.
-
getApplySuffix
public String getApplySuffix()
Return the suffix for migration resources (defaults to .sql).
-
setApplySuffix
public void setApplySuffix(String applySuffix)
Set the suffix for migration resources.
-
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.
-
getDbDriver
public String getDbDriver()
Return the DB Driver.Used when creating a Connection to run the migration.
-
setDbDriver
public void setDbDriver(String dbDriver)
Set the DB Driver.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
public String getPlatformName()
Return the DB platform name (used for platform create table and select for update syntax).
-
setPlatformName
public void setPlatformName(String platformName)
Set a DB platform name (to load specific create table and select for update syntax).
-
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()
Returns the jdbcMigrationFactory.
-
setJdbcMigrationFactory
public void setJdbcMigrationFactory(JdbcMigrationFactory jdbcMigrationFactory)
Sets the jdbcMigrationFactory.
-
getMinVersion
public String getMinVersion()
Returns the minVersion.
-
setMinVersion
public void setMinVersion(String minVersion)
Set the minVersion.
-
getMinVersionFailMessage
public String getMinVersionFailMessage()
Sets the optional minVersionFailMessage.
-
setMinVersionFailMessage
public void setMinVersionFailMessage(String minVersionFailMessage)
- Parameters:
minVersionFailMessage- the minVersionFailMessage to set
-
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.
-
-