public class MigrationConfig extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
MigrationConfig.DefaultMigrationFactory
Default factory.
|
| Constructor and Description |
|---|
MigrationConfig() |
| Modifier and Type | Method and Description |
|---|---|
Connection |
createConnection()
Create a Connection to the database using the configured driver, url, username etc.
|
String |
getApplySuffix()
Return the suffix for migration resources (defaults to .sql).
|
ClassLoader |
getClassLoader()
Return the ClassLoader to use to load resources.
|
String |
getDbDriver()
Return the DB Driver.
|
String |
getDbPassword()
Return the DB password.
|
String |
getDbSchema()
Return the DB connection Schema.
|
String |
getDbUrl()
Return the DB connection URL.
|
String |
getDbUsername()
Return the DB username.
|
JdbcMigrationFactory |
getJdbcMigrationFactory()
Returns the jdbcMigrationFactory.
|
String |
getMetaTable()
Return the name of the migration table.
|
String |
getMigrationInitPath()
Return the path for containing init migration scripts.
|
String |
getMigrationPath()
Return the root path used to find migrations.
|
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.
|
String |
getPlatformName()
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.
|
String |
getRunPlaceholders()
Return a Comma and equals delimited key/value placeholders to replace in DDL scripts.
|
boolean |
isAllowErrorInRepeatable()
Return true if we continue running the migration when a repeatable migration fails.
|
boolean |
isCreateSchemaIfNotExists()
Return true if migration should create the schema if it does not exist.
|
boolean |
isSetCurrentSchema()
Return true if the dbSchema should be set as current schema.
|
boolean |
isSkipChecksum()
Return true if checksum check should be skipped (during development).
|
void |
load(Properties props)
Load configuration from standard properties.
|
void |
setAllowErrorInRepeatable(boolean allowErrorInRepeatable)
Set to true to continue running the migration when a repeatable migration fails.
|
void |
setApplySuffix(String applySuffix)
Set the suffix for migration resources.
|
void |
setClassLoader(ClassLoader classLoader)
Set the ClassLoader to use when loading resources.
|
void |
setCreateSchemaIfNotExists(boolean createSchemaIfNotExists)
Set to create Schema if it does not exist.
|
void |
setDbDriver(String dbDriver)
Set the DB Driver.
|
void |
setDbPassword(String dbPassword)
Set the DB password.
|
void |
setDbSchema(String dbSchema)
Set the DB connection Schema.
|
void |
setDbUrl(String dbUrl)
Set the DB connection URL.
|
void |
setDbUsername(String dbUsername)
Set the DB username.
|
void |
setJdbcMigrationFactory(JdbcMigrationFactory jdbcMigrationFactory)
Sets the jdbcMigrationFactory.
|
void |
setMetaTable(String metaTable)
Set the name of the migration table.
|
void |
setMigrationInitPath(String migrationInitPath)
Set the path containing init migration scripts.
|
void |
setMigrationPath(String migrationPath)
Set the root path used to find migrations.
|
void |
setPatchInsertOn(Set<String> patchInsertOn)
Set the migrations that should not be run but inserted into history as if they have run.
|
void |
setPatchInsertOn(String versionsCommaDelimited)
Set the migrations that should not be run but inserted into history as if they have run.
|
void |
setPatchResetChecksumOn(Set<String> patchResetChecksumOn)
Set the migrations that should have their checksum reset.
|
void |
setPatchResetChecksumOn(String versionsCommaDelimited)
Set the migrations that should have their checksum reset as a comma delimited list.
|
void |
setPlatformName(String platformName)
Set a DB platform name (to load specific create table and select for update syntax).
|
void |
setRunPlaceholderMap(Map<String,String> runPlaceholderMap)
Set a map of name/value pairs that can be expressions replaced in migration scripts.
|
void |
setRunPlaceholders(String runPlaceholders)
Set a Comma and equals delimited key/value placeholders to replace in DDL scripts.
|
void |
setSetCurrentSchema(boolean setCurrentSchema)
Set if the dbSchema should be set as current schema.
|
void |
setSkipChecksum(boolean skipChecksum)
Set to true to skip the checksum check.
|
public MigrationConfig()
public String getMetaTable()
public void setMetaTable(String metaTable)
public boolean isAllowErrorInRepeatable()
public void setAllowErrorInRepeatable(boolean allowErrorInRepeatable)
public void setPatchResetChecksumOn(String versionsCommaDelimited)
public void setPatchResetChecksumOn(Set<String> patchResetChecksumOn)
public Set<String> getPatchResetChecksumOn()
public void setPatchInsertOn(String versionsCommaDelimited)
public void setPatchInsertOn(Set<String> patchInsertOn)
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).
public Set<String> getPatchInsertOn()
public boolean isSkipChecksum()
public void setSkipChecksum(boolean skipChecksum)
This is intended for use during development only.
public String getRunPlaceholders()
public void setRunPlaceholders(String runPlaceholders)
public Map<String,String> getRunPlaceholderMap()
public void setRunPlaceholderMap(Map<String,String> runPlaceholderMap)
public String getMigrationPath()
public void setMigrationPath(String migrationPath)
public String getMigrationInitPath()
public void setMigrationInitPath(String migrationInitPath)
public String getApplySuffix()
public void setApplySuffix(String applySuffix)
public String getDbUsername()
Used when a Connection to run the migration is not supplied.
public void setDbUsername(String dbUsername)
Used when a Connection to run the migration is not supplied.
public String getDbPassword()
Used when creating a Connection to run the migration.
public void setDbPassword(String dbPassword)
Used when creating a Connection to run the migration.
public String getDbDriver()
Used when creating a Connection to run the migration.
public void setDbDriver(String dbDriver)
Used when creating a Connection to run the migration.
public String getDbUrl()
Used when creating a Connection to run the migration.
public void setDbUrl(String dbUrl)
Used when creating a Connection to run the migration.
public String getDbSchema()
Used when creating a Connection to run the migration.
public void setDbSchema(String dbSchema)
Used when creating a Connection to run the migration.
public boolean isCreateSchemaIfNotExists()
public void setCreateSchemaIfNotExists(boolean createSchemaIfNotExists)
public boolean isSetCurrentSchema()
public void setSetCurrentSchema(boolean setCurrentSchema)
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.
public String getPlatformName()
public void setPlatformName(String platformName)
public ClassLoader getClassLoader()
public void setClassLoader(ClassLoader classLoader)
public JdbcMigrationFactory getJdbcMigrationFactory()
public void setJdbcMigrationFactory(JdbcMigrationFactory jdbcMigrationFactory)
public void load(Properties props)
public Connection createConnection()
Used when an existing DataSource or Connection is not supplied.
Copyright © 2019. All rights reserved.