Class DefaultConfiguration
- java.lang.Object
-
- migratedb.v1.core.api.configuration.DefaultConfiguration
-
- All Implemented Interfaces:
Configuration
public class DefaultConfiguration extends Object implements Configuration
JavaBean-style configuration for MigrateDB. This configuration can then be passed to MigrateDB using thenew MigrateDb(Configuration)constructor.
-
-
Constructor Summary
Constructors Constructor Description DefaultConfiguration()DefaultConfiguration(@Nullable ClassLoader classLoader)DefaultConfiguration(Configuration configuration)Creates a new configuration with the same values as this existing one.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FluentConfigurationasFluentConfiguration()voidconfigure(Map<String,String> props)Configures MigrateDB with these properties.voidconfigure(Properties properties)Configures MigrateDB with these properties.voidconfigure(Configuration configuration)Configure with the same values as this existing configuration.StringgetBaselineDescription()StringgetBaselineMigrationPrefix()VersiongetBaselineVersion()List<Callback>getCallbacks()List<MigrationPattern>getCherryPick()ClassLoadergetClassLoader()intgetConnectRetries()intgetConnectRetriesInterval()DatabaseTypeRegistergetDatabaseTypeRegister()@Nullable ConnectionProvidergetDataSource()StringgetDefaultSchema()CharsetgetEncoding()Map<Class<? extends ExtensionConfig>,? extends ExtensionConfig>getExtensionConfig()List<ValidatePattern>getIgnoreMigrationPatterns()StringgetInitSql()StringgetInstalledBy()ClassProvider<JavaMigration>getJavaMigrationClassProvider()List<JavaMigration>getJavaMigrations()Set<MigrateDbExtension>getLoadedExtensions()List<Location>getLocations()intgetLockRetryCount()LogSystemgetLogger()StringgetOldTable()StringgetPlaceholderPrefix()Map<String,String>getPlaceholders()StringgetPlaceholderSuffix()StringgetRepeatableSqlMigrationPrefix()List<MigrationResolver>getResolvers()ResourceProvidergetResourceProvider()List<String>getSchemas()StringgetScriptPlaceholderPrefix()StringgetScriptPlaceholderSuffix()StringgetSqlMigrationPrefix()StringgetSqlMigrationSeparator()List<String>getSqlMigrationSuffixes()StringgetTable()@Nullable StringgetTablespace()TargetVersiongetTarget()booleanisBaselineOnMigrate()booleanisCreateSchemas()booleanisFailOnMissingLocations()booleanisFailOnMissingTarget()booleanisGroup()booleanisIgnoreFutureMigrations()booleanisIgnoreIgnoredMigrations()booleanisIgnoreMissingMigrations()booleanisIgnorePendingMigrations()booleanisLiberateOnMigrate()booleanisMixed()booleanisOutOfOrder()booleanisOutputQueryResults()booleanisPlaceholderReplacement()booleanisSkipDefaultCallbacks()booleanisSkipDefaultResolvers()booleanisSkipExecutingMigrations()booleanisValidateMigrationNaming()booleanisValidateOnMigrate()voidsetBaselineDescription(String baselineDescription)Sets the description to tag an existing schema with when executing baseline.voidsetBaselineMigrationPrefix(String baselineMigrationPrefix)Sets the file name prefix for baseline migrations.voidsetBaselineOnMigrate(boolean baselineOnMigrate)Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.voidsetBaselineVersion(Version baselineVersion)Sets the version to tag an existing schema with when executing baseline.voidsetBaselineVersionAsString(String baselineVersion)Sets the version to tag an existing schema with when executing baseline.voidsetCallbacks(Collection<Callback> callbacks)Set the callbacks for lifecycle notifications.voidsetCallbacks(Callback... callbacks)Set the callbacks for lifecycle notifications.voidsetCallbacksAsClassNames(String... callbacks)Set the callbacks for lifecycle notifications.voidsetCallbacksAsClassNames(Collection<String> callbacks)Set the callbacks for lifecycle notifications.voidsetCherryPick(Collection<MigrationPattern> cherryPick)Sets the migrations that MigrateDB should consider when migrating.voidsetCherryPick(MigrationPattern... cherryPick)Sets the migrations that MigrateDB should consider when migrating.voidsetCherryPickAsString(String... cherryPickAsString)Sets the migrations that MigrateDB should consider when migrating.voidsetCherryPickAsString(Collection<String> cherryPickAsString)Sets the migrations that MigrateDB should consider when migrating.voidsetConnectRetries(int connectRetries)The maximum number of retries when attempting to connect to the database.voidsetConnectRetriesInterval(int connectRetriesInterval)The maximum time between retries when attempting to connect to the database in seconds.voidsetCreateSchemas(boolean createSchemas)Whether MigrateDB should attempt to create the schemas specified in the schemas property.voidsetDataSource(@Nullable DataSource dataSource)Sets the data source to use.voidsetDataSource(@Nullable ConnectionProvider dataSource)Sets the data source to use.voidsetDefaultSchema(String schema)Sets the default schema managed by MigrateDB.voidsetEncoding(Charset encoding)Sets the encoding of SQL migrations.voidsetEncodingAsString(String encoding)Sets the encoding of SQL migrations.<T extends ExtensionConfig>
voidsetExtensionConfig(Class<T> extensionConfigType, T value)Sets the extension config of typeT.voidsetFailOnMissingLocations(boolean failOnMissingLocations)Whether to fail if a location specified in themigratedb.locationsoption doesn't existvoidsetFailOnMissingTarget(boolean failOnMissingTarget)Whether to fail if no migration with the configured target version exists (default:true)voidsetGroup(boolean group)Whether to group all pending migrations together in the same transaction when applying them (only recommended for databases with support for DDL transactions).voidsetIgnoreFutureMigrations(boolean ignoreFutureMigrations)Whether to ignore future migrations when reading the schema history table.voidsetIgnoreIgnoredMigrations(boolean ignoreIgnoredMigrations)Ignore ignored migrations when reading the schema history table.voidsetIgnoreMigrationPatterns(Collection<ValidatePattern> ignoreMigrationPatterns)Ignore migrations that match the given ValidatePatterns when validating migrations.voidsetIgnoreMigrationPatterns(ValidatePattern... ignoreMigrationPatterns)Ignore migrations that match the given ValidatePatterns when validating migrations.voidsetIgnoreMigrationPatternsAsStrings(String... ignoreMigrationPatterns)Ignore migrations that match this list of patterns when validating migrations.voidsetIgnoreMigrationPatternsAsStrings(Collection<String> ignoreMigrationPatterns)Ignore migrations that match this list of patterns when validating migrations.voidsetIgnoreMissingMigrations(boolean ignoreMissingMigrations)Ignore missing migrations when reading the schema history table.voidsetIgnorePendingMigrations(boolean ignorePendingMigrations)Ignore pending migrations when reading the schema history table.voidsetInitSql(String initSql)The SQL statements to run to initialize a new database connection immediately after opening it.voidsetInstalledBy(String installedBy)The username that will be recorded in the schema history table as having applied the migration.voidsetJavaMigrationClassProvider(ClassProvider<JavaMigration> javaMigrationClassProvider)The custom ClassProvider to be used to look upJavaMigrationclasses.voidsetJavaMigrations(Collection<JavaMigration> javaMigrations)The additional Java-based migrations.voidsetJavaMigrations(JavaMigration... javaMigrations)The additional Java-based migrations.voidsetLiberateOnMigrate(boolean liberateOnMigrate)Whether theliberatecommand is automatically executed onmigrateif the schema history table does not exist, butoldTableexists.voidsetLocations(Collection<Location> locations)Sets the locations to scan recursively for migrations.voidsetLocations(Location... locations)Sets the locations to scan recursively for migrations.voidsetLocationsAsStrings(String... locations)Sets the locations to scan recursively for migrations.voidsetLocationsAsStrings(Collection<String> locations)Sets the locations to scan recursively for migrations.voidsetLockRetryCount(int lockRetryCount)Sets the maximum number of retries when trying to obtain a lock. -1 indicates attempting to repeat indefinitely.voidsetLogger(String... logger)The log system(s) MigrateDB should use.voidsetLogger(LogSystem logger)The log system MigrateDB should use.voidsetMixed(boolean mixed)Whether to allow mixing transactional and non-transactional statements within the same migration.voidsetOldTable(String oldTable)Sets the name of the old table to convert into the format used by MigrateDB.voidsetOutOfOrder(boolean outOfOrder)Allows migrations to be run "out of order".voidsetOutputQueryResults(boolean outputQueryResults)Whether MigrateDB should output a table with the results of queries when executing migrations.voidsetPlaceholderPrefix(String placeholderPrefix)Sets the prefix of every placeholder.voidsetPlaceholderReplacement(boolean placeholderReplacement)Sets whether placeholders should be replaced.voidsetPlaceholders(Map<String,String> placeholders)Sets the placeholders to replace in SQL migration scripts.voidsetPlaceholderSuffix(String placeholderSuffix)Sets the suffix of every placeholder.voidsetRepeatableSqlMigrationPrefix(String repeatableSqlMigrationPrefix)Sets the file name prefix for repeatable SQL migrations.voidsetResolvers(Collection<MigrationResolver> resolvers)Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.voidsetResolvers(MigrationResolver... resolvers)Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.voidsetResolversAsClassNames(String... resolvers)Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.voidsetResolversAsClassNames(Collection<String> resolvers)Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.voidsetResourceProvider(ResourceProvider resourceProvider)Set the custom ResourceProvider to be used to look up resources.voidsetSchemas(String... schemas)Sets the schemas managed by MigrateDB.voidsetSchemas(Collection<String> schemas)Sets the schemas managed by MigrateDB.voidsetScriptPlaceholderPrefix(String scriptPlaceholderPrefix)Sets the prefix of every script placeholder.voidsetScriptPlaceholderSuffix(String scriptPlaceholderSuffix)Sets the suffix of every placeholder.voidsetSkipDefaultCallbacks(boolean skipDefaultCallbacks)Whether MigrateDB should skip the default callbacks.voidsetSkipDefaultResolvers(boolean skipDefaultResolvers)Whether MigrateDB should skip the default resolvers.voidsetSkipExecutingMigrations(boolean skipExecutingMigrations)Whether MigrateDB should skip actually executing the contents of the migrations and only update the schema history table.voidsetSqlMigrationPrefix(String sqlMigrationPrefix)Sets the file name prefix for SQL migrations.voidsetSqlMigrationSeparator(String sqlMigrationSeparator)Sets the file name separator for SQL migrations.voidsetSqlMigrationSuffixes(String... sqlMigrationSuffixes)The file name suffixes for SQL migrations.voidsetSqlMigrationSuffixes(Collection<String> sqlMigrationSuffixes)The file name suffixes for SQL migrations.voidsetTable(String table)Sets the name of the schema history table that will be used by MigrateDB.voidsetTablespace(@Nullable String tablespace)Sets the tablespace where to create the schema history table that will be used by MigrateDB.voidsetTarget(TargetVersion target)Sets the target version up to which MigrateDB should consider migrations.voidsetTargetAsString(String target)Sets the target version up to which MigrateDB should consider migrations.voidsetValidateMigrationNaming(boolean validateMigrationNaming)Whether to validate migrations and callbacks whose scripts do not obey the correct naming convention.voidsetValidateOnMigrate(boolean validateOnMigrate)Whether to automatically call validate or not when running migrate.voiduseExtension(MigrateDbExtension extension)Enables a single MigrateDB extension.voiduseExtensions(Iterable<MigrateDbExtension> extensions)Enables multiple MigrateDB extensions.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface migratedb.v1.core.api.configuration.Configuration
getExtensionConfig
-
-
-
-
Constructor Detail
-
DefaultConfiguration
public DefaultConfiguration()
-
DefaultConfiguration
public DefaultConfiguration(@Nullable ClassLoader classLoader)
- Parameters:
classLoader- The ClassLoader to use for loading migrations, resolvers, etc. from the classpath. (default: Thread.currentThread().getContextClassLoader()). Nullable for compatibility.
-
DefaultConfiguration
public DefaultConfiguration(Configuration configuration)
Creates a new configuration with the same values as this existing one.
-
-
Method Detail
-
asFluentConfiguration
public FluentConfiguration asFluentConfiguration()
- Returns:
- Fluent interface that delegates to this configuration instance.
-
getLocations
public List<Location> getLocations()
- Specified by:
getLocationsin interfaceConfiguration- Returns:
- The locations to scan recursively for migrations. The location type is determined by its prefix.
Unprefixed locations or locations starting with
classpath:point to a package on the classpath and may contain both SQL and Java-based migrations. Locations starting withfilesystem:point to a directory on the filesystem, may only contain SQL migrations and are only scanned recursively down non-hidden directories. (default: classpath:db/migration)
-
getEncoding
public Charset getEncoding()
- Specified by:
getEncodingin interfaceConfiguration- Returns:
- The encoding of SQL migrations. (default: UTF-8)
-
getDefaultSchema
public String getDefaultSchema()
- Specified by:
getDefaultSchemain interfaceConfiguration- Returns:
- The default schema managed by MigrateDB. This schema name is case-sensitive. If not specified, but
schemas
is, MigrateDB uses the first schema in that list. If that is also not specified, MigrateDb uses the default
schema for the database connection.
Consequences:
- This schema will be the one containing the schema history table.
- This schema will be the default for the database connection (provided the database supports this concept) .
-
getSchemas
public List<String> getSchemas()
- Specified by:
getSchemasin interfaceConfiguration- Returns:
- The schemas managed by MigrateDB. These schema names are case-sensitive. If not specified, MigrateDB uses
the default schema for the database connection. If defaultSchemaName is not specified, then the first of
this list also acts as default schema.
Consequences:
- MigrateDB will automatically attempt to create all these schemas, unless they already exist.
-
getTable
public String getTable()
- Specified by:
getTablein interfaceConfiguration- Returns:
- The name of the schema history table that will be used by MigrateDB. By default, (single-schema mode) the schema history table is placed in the default schema for the connection provided by the datasource. When the migratedb.schemas property is set (multi-schema mode), the schema history table is placed in the first schema of the list. (default: migratedb_state)
-
getOldTable
public String getOldTable()
- Specified by:
getOldTablein interfaceConfiguration- Returns:
- The old table to convert into the format used by MigrateDB. Only used for the "liberate" command.
-
isLiberateOnMigrate
public boolean isLiberateOnMigrate()
- Specified by:
isLiberateOnMigratein interfaceConfiguration- Returns:
- Whether the
liberatecommand is automatically executed onmigrateif the schema history table does not exist, butoldTableexists. (Default:true)
-
getTablespace
public @Nullable String getTablespace()
- Specified by:
getTablespacein interfaceConfiguration- Returns:
- The tablespace where to create the schema history table that will be used by MigrateDB. If not specified, MigrateDB uses the default tablespace for the database connection. This setting is only relevant for databases that do support the notion of tablespaces. Its value is simply ignored for all others.
-
getTarget
public TargetVersion getTarget()
- Specified by:
getTargetin interfaceConfiguration- Returns:
- The target version up to which MigrateDB should consider migrations. Migrations with a higher version
number will be ignored. Special values:
current: Designates the current version of the schemalatest: The latest version of the schema, as defined by the migration with the highest version- <version>? (end with a '?'): Instructs MigrateDB not to fail if the target version doesn't exist. In this case, MigrateDB will go up to but not beyond the specified target (default: fail if the target version doesn't exist)
latest
-
isFailOnMissingTarget
public boolean isFailOnMissingTarget()
- Specified by:
isFailOnMissingTargetin interfaceConfiguration- Returns:
- Whether to fail if no migration with the configured target version exists (default:
true)
-
getCherryPick
public List<MigrationPattern> getCherryPick()
- Specified by:
getCherryPickin interfaceConfiguration- Returns:
- The migrations that MigrateDb should consider when migrating. Leave empty to consider all available migrations. Migrations not in this list will be ignored.
-
isPlaceholderReplacement
public boolean isPlaceholderReplacement()
- Specified by:
isPlaceholderReplacementin interfaceConfiguration- Returns:
- Whether placeholders should be replaced. (default: true)
-
getPlaceholders
public Map<String,String> getPlaceholders()
- Specified by:
getPlaceholdersin interfaceConfiguration- Returns:
- The map of <placeholder, replacementValue> to apply to sql migration scripts.
-
getPlaceholderPrefix
public String getPlaceholderPrefix()
- Specified by:
getPlaceholderPrefixin interfaceConfiguration- Returns:
- The prefix of every placeholder. (default: ${ )
-
getPlaceholderSuffix
public String getPlaceholderSuffix()
- Specified by:
getPlaceholderSuffixin interfaceConfiguration- Returns:
- The suffix of every placeholder. (default: } )
-
getScriptPlaceholderPrefix
public String getScriptPlaceholderPrefix()
- Specified by:
getScriptPlaceholderPrefixin interfaceConfiguration- Returns:
- The prefix of every script placeholder. (default: FP__ )
-
getScriptPlaceholderSuffix
public String getScriptPlaceholderSuffix()
- Specified by:
getScriptPlaceholderSuffixin interfaceConfiguration- Returns:
- The suffix of every script placeholder. (default: __ )
-
getSqlMigrationPrefix
public String getSqlMigrationPrefix()
- Specified by:
getSqlMigrationPrefixin interfaceConfiguration- Returns:
- The file name prefix for versioned SQL migrations. Versioned SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1.1__My_description.sql. (default: V)
-
getBaselineMigrationPrefix
public String getBaselineMigrationPrefix()
- Specified by:
getBaselineMigrationPrefixin interfaceConfiguration- Returns:
- The file name prefix for baseline migrations. Baseline migrations represent all migrations with
version <= current baseline migration versionwhile keeping older migrations if needed for upgrading older deployments. They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to B1.1__My_description.sql. (default: B)
-
getRepeatableSqlMigrationPrefix
public String getRepeatableSqlMigrationPrefix()
- Specified by:
getRepeatableSqlMigrationPrefixin interfaceConfiguration- Returns:
- The file name prefix for repeatable SQL migrations. Repeatable SQL migrations have the following file name structure: prefixSeparatorDESCRIPTIONsuffix, which using the defaults translates to R__My_description.sql. (default: R)
-
getSqlMigrationSeparator
public String getSqlMigrationSeparator()
- Specified by:
getSqlMigrationSeparatorin interfaceConfiguration- Returns:
- The file name separator for SQL migrations. SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1.1__My_description.sql. (default: __)
-
getSqlMigrationSuffixes
public List<String> getSqlMigrationSuffixes()
- Specified by:
getSqlMigrationSuffixesin interfaceConfiguration- Returns:
- The file name suffixes for SQL migrations. SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1_1__My_description.sql Multiple suffixes (like .sql,.pkg,.pkb) can be specified for easier compatibility with other tools such as editors with specific file associations. (default: .sql)
-
getJavaMigrations
public List<JavaMigration> getJavaMigrations()
- Specified by:
getJavaMigrationsin interfaceConfiguration- Returns:
- The additional Java-based migrations. These are not Java-based migrations discovered through classpath scanning and instantiated by MigrateDB. Instead, these are manually added instances of JavaMigration. This is particularly useful when working with a dependency injection container, where you may want the DI container to instantiate the class and wire up its dependencies for you. An empty list if none. (default: none)
-
isIgnoreMissingMigrations
public boolean isIgnoreMissingMigrations()
- Specified by:
isIgnoreMissingMigrationsin interfaceConfiguration- Returns:
- Ignore missing migrations when reading the schema history table. These are migrations that were performed
by an older deployment of the application that are no longer available in this version. For example: we have
migrations available on the classpath with versions 1.0 and 3.0. The schema history table indicates that a
migration with version 2.0 (unknown to us) has also been applied. Instead of bombing out (fail fast) with an
exception, a warning is logged and MigrateDB continues normally. This is useful for situations where one must be
able to deploy a newer version of the application even though it doesn't contain migrations included with an
older one anymore. Note that if the most recently applied migration is removed, MigrateDb has no way to know it
is missing and will mark it as future instead.
trueto continue normally and log a warning,falseto fail fast with an exception. (default:false)
-
isIgnoreIgnoredMigrations
public boolean isIgnoreIgnoredMigrations()
- Specified by:
isIgnoreIgnoredMigrationsin interfaceConfiguration- Returns:
- Ignore ignored migrations when reading the schema history table. These are migrations that were added in
between already migrated migrations in this version. For example: we have migrations available on the classpath
with versions from 1.0 to 3.0. The schema history table indicates that version 1 was finished on 1.0.15, and the
next one was 2.0.0. But with the next release a new migration was added to version 1: 1.0.16. Such scenario is
ignored by migrate command, but by default is rejected by validate. When ignoreIgnoredMigrations is enabled, such
case will not be reported by validate command. This is useful for situations where one must be able to deliver
complete set of migrations in a delivery package for multiple versions of the product, and allows for further
development of older versions.
trueto continue normally,falseto fail fast with an exception. (default:false)
-
isIgnorePendingMigrations
public boolean isIgnorePendingMigrations()
- Specified by:
isIgnorePendingMigrationsin interfaceConfiguration- Returns:
- Ignore pending migrations when reading the schema history table. These are migrations that are available
but have not yet been applied. This can be useful for verifying that in-development migration changes don't
contain any validation-breaking changes of migrations that have already been applied to a production environment,
e.g. as part of a CI/CD process, without failing because of the existence of new migration versions.
trueto continue normally,falseto fail fast with an exception. (default:false)
-
isIgnoreFutureMigrations
public boolean isIgnoreFutureMigrations()
- Specified by:
isIgnoreFutureMigrationsin interfaceConfiguration- Returns:
- Ignore future migrations when reading the schema history table. These are migrations that were performed
by a newer deployment of the application that are not yet available in this version. For example: we have
migrations available on the classpath up to version 3.0. The schema history table indicates that a migration to
version 4.0 (unknown to us) has already been applied. Instead of bombing out (fail fast) with an exception, a
warning is logged and MigrateDB continues normally. This is useful for situations where one must be able to
redeploy an older version of the application after the database has been migrated by a newer one.
trueto continue normally and log a warning,falseto fail fast with an exception. (default:true)
-
getIgnoreMigrationPatterns
public List<ValidatePattern> getIgnoreMigrationPatterns()
- Specified by:
getIgnoreMigrationPatternsin interfaceConfiguration- Returns:
- Patterns of ignored migrations. Each pattern is of the form
<migration_type>:<migration_state>. See the website for full details.Example: repeatable:missing,versioned:pending,*:failed
(default: none)
-
isValidateMigrationNaming
public boolean isValidateMigrationNaming()
- Specified by:
isValidateMigrationNamingin interfaceConfiguration- Returns:
- Whether to validate migrations and callbacks whose scripts do not obey the correct naming convention. A
failure can be useful to check that errors such as case sensitivity in migration prefixes have been corrected.
falseto continue normally,trueto fail fast with an exception. (default:false)
-
isValidateOnMigrate
public boolean isValidateOnMigrate()
- Specified by:
isValidateOnMigratein interfaceConfiguration- Returns:
- Whether to automatically call validate or not when running migrate.
trueif validate should be called.falseif not. (default:true)
-
getBaselineVersion
public Version getBaselineVersion()
- Specified by:
getBaselineVersionin interfaceConfiguration- Returns:
- The version to tag an existing schema with when executing baseline. (default: 1)
-
getBaselineDescription
public String getBaselineDescription()
- Specified by:
getBaselineDescriptionin interfaceConfiguration- Returns:
- The description to tag an existing schema with when executing baseline. (default: << MigrateDB Baseline >>)
-
isBaselineOnMigrate
public boolean isBaselineOnMigrate()
- Specified by:
isBaselineOnMigratein interfaceConfiguration- Returns:
- Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema
history table. This schema will then be initialized with the
baselineVersionbefore executing the migrations. Only migrations abovebaselineVersionwill then be applied.This is useful for initial MigrateDB production deployments on projects with an existing DB.
Be careful when enabling this as it removes the safety net that ensures MigrateDB does not migrate the wrong database in case of a configuration mistake! (default:
false)
-
isOutOfOrder
public boolean isOutOfOrder()
- Specified by:
isOutOfOrderin interfaceConfiguration- Returns:
- Whether migrations are allowed to be run "out of order". If you already have versions 1 and 3 applied,
and now a version 2 is found, it will be applied too instead of being ignored. (default:
false)
-
isSkipExecutingMigrations
public boolean isSkipExecutingMigrations()
- Specified by:
isSkipExecutingMigrationsin interfaceConfiguration- Returns:
- Whether MigrateDB should skip actually executing the contents of the migrations and only update the
schema history table. This should be used when you have applied a migration manually (via executing the sql
yourself, or via an ide), and just want the schema history table to reflect this.
Use in conjunction with
cherryPickto skip specific migrations instead of all pending ones. (default:false)
-
getResolvers
public List<MigrationResolver> getResolvers()
- Specified by:
getResolversin interfaceConfiguration- Returns:
- The custom
MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply. An empty list if none. (default: none)
-
isSkipDefaultResolvers
public boolean isSkipDefaultResolvers()
- Specified by:
isSkipDefaultResolversin interfaceConfiguration- Returns:
- Whether default built-in resolvers should be skipped. If true, only custom resolvers are used. (default: false)
-
getDataSource
public @Nullable ConnectionProvider getDataSource()
- Specified by:
getDataSourcein interfaceConfiguration- Returns:
- The data source to use to access the database. Must have the necessary privileges to execute DDL.
-
getConnectRetries
public int getConnectRetries()
- Specified by:
getConnectRetriesin interfaceConfiguration- Returns:
- The maximum number of retries when attempting to connect to the database. After each failed attempt, MigrateDB will wait 1 second before attempting to connect again, up to the maximum number of times specified by * connectRetries. The interval between retries doubles with each subsequent attempt. (default: 0)
-
getConnectRetriesInterval
public int getConnectRetriesInterval()
- Specified by:
getConnectRetriesIntervalin interfaceConfiguration- Returns:
- The maximum time between retries when attempting to connect to the database in seconds. This will cap the interval between connect retry to the value provided. (default: 120)
-
getInitSql
public String getInitSql()
- Specified by:
getInitSqlin interfaceConfiguration- Returns:
- The SQL statements to run to initialize a new database connection immediately after opening it. (default:
null)
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoaderin interfaceConfiguration- Returns:
- The ClassLoader to use for loading migrations, resolvers, etc. from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
isMixed
public boolean isMixed()
- Specified by:
isMixedin interfaceConfiguration- Returns:
- Whether to allow mixing transactional and non-transactional statements within the same migration.
Enabling this automatically causes the entire affected migration to be run without a transaction.
Note that this is only applicable for PostgreSQL, Aurora PostgreSQL, SQL Server and SQLite which all have statements that do not run at all within a transaction. This is not to be confused with implicit transaction, as they occur in MySQL or Oracle, where even though a DDL statement was run within a transaction, the database will issue an implicit commit before and after its execution.
trueif mixed migrations should be allowed.falseif an error should be thrown instead. (default:false)
-
getInstalledBy
public String getInstalledBy()
- Specified by:
getInstalledByin interfaceConfiguration- Returns:
- The username that will be recorded in the schema history table as having applied the migration, or
nullfor the current database user of the connection (default:null).
-
isGroup
public boolean isGroup()
- Specified by:
isGroupin interfaceConfiguration- Returns:
- Whether to group all pending migrations together in the same transaction when applying them (only
recommended for databases with support for DDL transactions).
trueif migrations should be grouped.falseif they should be applied individually instead. (default:false)
-
getLockRetryCount
public int getLockRetryCount()
- Specified by:
getLockRetryCountin interfaceConfiguration- Returns:
- The maximum number of retries when trying to obtain a lock. -1 indicates attempting to repeat indefinitely.
-
getLogger
public LogSystem getLogger()
- Specified by:
getLoggerin interfaceConfiguration- Returns:
- The log system MigrateDB should use.
-
isFailOnMissingLocations
public boolean isFailOnMissingLocations()
- Specified by:
isFailOnMissingLocationsin interfaceConfiguration- Returns:
- Whether to fail if a location specified in the
migratedb.locationsoption doesn't exist. (default:false)
-
isOutputQueryResults
public boolean isOutputQueryResults()
- Specified by:
isOutputQueryResultsin interfaceConfiguration- Returns:
- Whether MigrateDB should output a table with the results of queries when executing migrations.
trueto output the results table (default:true)
-
getResourceProvider
public ResourceProvider getResourceProvider()
- Specified by:
getResourceProviderin interfaceConfiguration- Returns:
- The custom ResourceProvider to be used to look up resources. If not set, the default strategy will be used. (default: null)
-
getJavaMigrationClassProvider
public ClassProvider<JavaMigration> getJavaMigrationClassProvider()
- Specified by:
getJavaMigrationClassProviderin interfaceConfiguration- Returns:
- The custom ClassProvider to be used to look up
JavaMigrationclasses. If not set, the default strategy will be used. (default: null)
-
isCreateSchemas
public boolean isCreateSchemas()
- Specified by:
isCreateSchemasin interfaceConfiguration- Returns:
- Whether MigrateDB should attempt to create the schemas specified in the
schemasproperty. (default:true)
-
getCallbacks
public List<Callback> getCallbacks()
- Specified by:
getCallbacksin interfaceConfiguration- Returns:
- The callbacks for lifecycle notifications. An empty list if none. (default: none)
-
isSkipDefaultCallbacks
public boolean isSkipDefaultCallbacks()
- Specified by:
isSkipDefaultCallbacksin interfaceConfiguration- Returns:
- Whether default built-in callbacks should be skipped. If true, only custom callbacks are used. (default: false)
-
getDatabaseTypeRegister
public DatabaseTypeRegister getDatabaseTypeRegister()
- Specified by:
getDatabaseTypeRegisterin interfaceConfiguration- Returns:
- The database type register.
-
getLoadedExtensions
public Set<MigrateDbExtension> getLoadedExtensions()
- Specified by:
getLoadedExtensionsin interfaceConfiguration- Returns:
- Unmodifiable set of extensions that have been loaded into this configuration.
-
getExtensionConfig
public Map<Class<? extends ExtensionConfig>,? extends ExtensionConfig> getExtensionConfig()
- Specified by:
getExtensionConfigin interfaceConfiguration- Returns:
- A read-only view of the extension config (by type).
-
setGroup
public void setGroup(boolean group)
Whether to group all pending migrations together in the same transaction when applying them (only recommended for databases with support for DDL transactions).
-
setInstalledBy
public void setInstalledBy(String installedBy)
The username that will be recorded in the schema history table as having applied the migration.
-
setLogger
public void setLogger(LogSystem logger)
The log system MigrateDB should use.
-
setLogger
public void setLogger(String... logger)
The log system(s) MigrateDB should use.
-
setMixed
public void setMixed(boolean mixed)
Whether to allow mixing transactional and non-transactional statements within the same migration. Enabling this automatically causes the entire affected migration to be run without a transaction.Note that this is only applicable for PostgreSQL, Aurora PostgreSQL, SQL Server and SQLite which all have statements that do not run at all within a transaction. This is not to be confused with implicit transaction, as they occur in MySQL or Oracle, where even though a DDL statement was run within a transaction, the database will issue an implicit commit before and after its execution.
-
setIgnoreMissingMigrations
public void setIgnoreMissingMigrations(boolean ignoreMissingMigrations)
Ignore missing migrations when reading the schema history table. These are migrations that were performed by an older deployment of the application that are no longer available in this version. For example: we have migrations available on the classpath with versions 1.0 and 3.0. The schema history table indicates that a migration with version 2.0 (unknown to us) has also been applied. Instead of bombing out (fail fast) with an exception, a warning is logged and MigrateDB continues normally. This is useful for situations where one must be able to deploy a newer version of the application even though it doesn't contain migrations included with an older one anymore. Note that if the most recently applied migration is removed, MigrateDB has no way to know it is missing and will mark it as future instead.
-
setIgnoreIgnoredMigrations
public void setIgnoreIgnoredMigrations(boolean ignoreIgnoredMigrations)
Ignore ignored migrations when reading the schema history table. These are migrations that were added in between already migrated migrations in this version. For example: we have migrations available on the classpath with versions from 1.0 to 3.0. The schema history table indicates that version 1 was finished on 1.0.15, and the next one was 2.0.0. But with the next release a new migration was added to version 1: 1.0.16. Such scenario is ignored by migrate command, but by default is rejected by validate. When ignoreIgnoredMigrations is enabled, such case will not be reported by validate command. This is useful for situations where one must be able to deliver complete set of migrations in a delivery package for multiple versions of the product, and allows for further development of older versions.
-
setIgnorePendingMigrations
public void setIgnorePendingMigrations(boolean ignorePendingMigrations)
Ignore pending migrations when reading the schema history table. These are migrations that are available but have not yet been applied. This can be useful for verifying that in-development migration changes don't contain any validation-breaking changes of migrations that have already been applied to a production environment, e.g. as part of a CI/CD process, without failing because of the existence of new migration versions.
-
setIgnoreFutureMigrations
public void setIgnoreFutureMigrations(boolean ignoreFutureMigrations)
Whether to ignore future migrations when reading the schema history table. These are migrations that were performed by a newer deployment of the application that are not yet available in this version. For example: we have migrations available on the classpath up to version 3.0. The schema history table indicates that a migration to version 4.0 (unknown to us) has already been applied. Instead of bombing out (fail fast) with an exception, a warning is logged and MigrateDB continues normally. This is useful for situations where one must be able to redeploy an older version of the application after the database has been migrated by a newer one.
-
setIgnoreMigrationPatternsAsStrings
public void setIgnoreMigrationPatternsAsStrings(String... ignoreMigrationPatterns)
Ignore migrations that match this list of patterns when validating migrations. Each pattern is of the form<migration_type>:<migration_state>. See the website for full details.Example: repeatable:missing,versioned:pending,*:failed
-
setIgnoreMigrationPatternsAsStrings
public void setIgnoreMigrationPatternsAsStrings(Collection<String> ignoreMigrationPatterns)
Ignore migrations that match this list of patterns when validating migrations. Each pattern is of the form<migration_type>:<migration_state>. See the website for full details.Example: repeatable:missing,versioned:pending,*:failed
-
setIgnoreMigrationPatterns
public void setIgnoreMigrationPatterns(ValidatePattern... ignoreMigrationPatterns)
Ignore migrations that match the given ValidatePatterns when validating migrations.
-
setIgnoreMigrationPatterns
public void setIgnoreMigrationPatterns(Collection<ValidatePattern> ignoreMigrationPatterns)
Ignore migrations that match the given ValidatePatterns when validating migrations.
-
setValidateMigrationNaming
public void setValidateMigrationNaming(boolean validateMigrationNaming)
Whether to validate migrations and callbacks whose scripts do not obey the correct naming convention. A failure can be useful to check that errors such as case sensitivity in migration prefixes have been corrected.
-
setValidateOnMigrate
public void setValidateOnMigrate(boolean validateOnMigrate)
Whether to automatically call validate or not when running migrate.
-
setLocationsAsStrings
public void setLocationsAsStrings(String... locations)
Sets the locations to scan recursively for migrations. The location type is determined by its prefix. Unprefixed locations or locations starting withclasspath:point to a package on the classpath and may contain both SQL and Java-based migrations. Locations starting withfilesystem:point to a directory on the filesystem, may only contain SQL migrations and are only scanned recursively down non-hidden directories.
-
setLocationsAsStrings
public void setLocationsAsStrings(Collection<String> locations)
Sets the locations to scan recursively for migrations. The location type is determined by its prefix. Unprefixed locations or locations starting withclasspath:point to a package on the classpath and may contain both SQL and Java-based migrations. Locations starting withfilesystem:point to a directory on the filesystem, may only contain SQL migrations and are only scanned recursively down non-hidden directories.
-
setLocations
public void setLocations(Location... locations)
Sets the locations to scan recursively for migrations. The location type is determined by its prefix. Unprefixed locations or locations starting withclasspath:point to a package on the classpath and may contain both SQL and Java-based migrations. Locations starting withfilesystem:point to a directory on the filesystem, may only contain SQL migrations and are only scanned recursively down non-hidden directories.
-
setLocations
public void setLocations(Collection<Location> locations)
Sets the locations to scan recursively for migrations. The location type is determined by its prefix. Unprefixed locations or locations starting withclasspath:point to a package on the classpath and may contain both SQL and Java-based migrations. Locations starting withfilesystem:point to a directory on the filesystem, may only contain SQL migrations and are only scanned recursively down non-hidden directories.
-
setEncoding
public void setEncoding(Charset encoding)
Sets the encoding of SQL migrations.
-
setEncodingAsString
public void setEncodingAsString(String encoding)
Sets the encoding of SQL migrations.
-
setDefaultSchema
public void setDefaultSchema(String schema)
Sets the default schema managed by MigrateDB. This schema name is case-sensitive. If not specified, but Schemas is, MigrateDB uses the first schema in that list. If that is also not specified, MigrateDb uses the default schema for the database connection.Consequences:
- This schema will be the one containing the schema history table.
- This schema will be the default for the database connection (provided the database supports this concept) .
-
setSchemas
public void setSchemas(String... schemas)
Sets the schemas managed by MigrateDB. These schema names are case-sensitive. If not specified, MigrateDB uses the default schema for the database connection. If defaultSchema is not specified, then the first of this list also acts as default schema.Consequences:
- MigrateDB will automatically attempt to create all these schemas, unless they already exist.
-
setSchemas
public void setSchemas(Collection<String> schemas)
Sets the schemas managed by MigrateDB. These schema names are case-sensitive. If not specified, MigrateDB uses the default schema for the database connection. If defaultSchema is not specified, then the first of this list also acts as default schema.Consequences:
- MigrateDB will automatically attempt to create all these schemas, unless they already exist.
-
setTable
public void setTable(String table)
Sets the name of the schema history table that will be used by MigrateDB. By default (single-schema mode) the schema history table is placed in the default schema for the connection provided by the datasource. When the migratedb.schemas property is set (multi-schema mode), the schema history table is placed in the first schema of the list.
-
setOldTable
public void setOldTable(String oldTable)
Sets the name of the old table to convert into the format used by MigrateDB. Only used for the "liberate" command.
-
setTablespace
public void setTablespace(@Nullable String tablespace)
Sets the tablespace where to create the schema history table that will be used by MigrateDB. If not specified, MigrateDb uses the default tablespace for the database connection.This setting is only relevant for databases that do support the notion of tablespaces. Its value is simply ignored for all others.
-
setTarget
public void setTarget(TargetVersion target)
Sets the target version up to which MigrateDB should consider migrations. Migrations with a higher version number will be ignored. Special values:current: Designates the current version of the schemalatest: The latest version of the schema, as defined by the migration with the highest versionnext: The next version of the schema, as defined by the first pending migration
latest.
-
setTargetAsString
public void setTargetAsString(String target)
Sets the target version up to which MigrateDB should consider migrations. Migrations with a higher version number will be ignored. Special values:current: Designates the current version of the schemalatest: The latest version of the schema, as defined by the migration with the highest versionnext: The next version of the schema, as defined by the first pending migration- <version>? (end with a '?'): Instructs MigrateDB not to fail if the target version doesn't exist. In this case, MigrateDb will go up to but not beyond the specified target (default: fail if the target version doesn't exist)
latest.
-
setFailOnMissingTarget
public void setFailOnMissingTarget(boolean failOnMissingTarget)
Whether to fail if no migration with the configured target version exists (default:true)
-
setCherryPick
public void setCherryPick(MigrationPattern... cherryPick)
Sets the migrations that MigrateDB should consider when migrating. Leave empty to consider all available migrations. Migrations not in this list will be ignored.
-
setCherryPick
public void setCherryPick(Collection<MigrationPattern> cherryPick)
Sets the migrations that MigrateDB should consider when migrating. Leave empty to consider all available migrations. Migrations not in this list will be ignored.
-
setCherryPickAsString
public void setCherryPickAsString(String... cherryPickAsString)
Sets the migrations that MigrateDB should consider when migrating. Leave empty to consider all available migrations. Migrations not in this list will be ignored. Values should be the version for versioned migrations (e.g. 1, 2.4, 6.5.3) or the description for repeatable migrations (e.g. Insert_Data, Create_Table)
-
setCherryPickAsString
public void setCherryPickAsString(Collection<String> cherryPickAsString)
Sets the migrations that MigrateDB should consider when migrating. Leave empty to consider all available migrations. Migrations not in this list will be ignored. Values should be the version for versioned migrations (e.g. 1, 2.4, 6.5.3) or the description for repeatable migrations (e.g. Insert_Data, Create_Table)
-
setPlaceholderReplacement
public void setPlaceholderReplacement(boolean placeholderReplacement)
Sets whether placeholders should be replaced.
-
setPlaceholders
public void setPlaceholders(Map<String,String> placeholders)
Sets the placeholders to replace in SQL migration scripts.
-
setPlaceholderPrefix
public void setPlaceholderPrefix(String placeholderPrefix)
Sets the prefix of every placeholder.
-
setScriptPlaceholderPrefix
public void setScriptPlaceholderPrefix(String scriptPlaceholderPrefix)
Sets the prefix of every script placeholder.
-
setPlaceholderSuffix
public void setPlaceholderSuffix(String placeholderSuffix)
Sets the suffix of every placeholder.
-
setScriptPlaceholderSuffix
public void setScriptPlaceholderSuffix(String scriptPlaceholderSuffix)
Sets the suffix of every placeholder.
-
setSqlMigrationPrefix
public void setSqlMigrationPrefix(String sqlMigrationPrefix)
Sets the file name prefix for SQL migrations. SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1_1__My_description.sql
-
setBaselineMigrationPrefix
public void setBaselineMigrationPrefix(String baselineMigrationPrefix)
Sets the file name prefix for baseline migrations. They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to B1__My_description.sql
-
setJavaMigrations
public void setJavaMigrations(JavaMigration... javaMigrations)
The additional Java-based migrations. These are not Java-based migrations discovered through classpath scanning and instantiated by MigrateDB. Instead, these are application-managed instances of JavaMigration. This is particularly useful when working with a dependency injection container, where you may want the DI container to instantiate the class and wire up its dependencies for you.
-
setJavaMigrations
public void setJavaMigrations(Collection<JavaMigration> javaMigrations)
The additional Java-based migrations. These are not Java-based migrations discovered through classpath scanning and instantiated by MigrateDB. Instead, these are application-managed instances of JavaMigration. This is particularly useful when working with a dependency injection container, where you may want the DI container to instantiate the class and wire up its dependencies for you.
-
setRepeatableSqlMigrationPrefix
public void setRepeatableSqlMigrationPrefix(String repeatableSqlMigrationPrefix)
Sets the file name prefix for repeatable SQL migrations. Repeatable SQL migrations have the following file name structure: prefixSeparatorDESCRIPTIONsuffix, which using the defaults translates to R__My_description.sql
-
setSqlMigrationSeparator
public void setSqlMigrationSeparator(String sqlMigrationSeparator)
Sets the file name separator for SQL migrations. SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1_1__My_description.sql
-
setSqlMigrationSuffixes
public void setSqlMigrationSuffixes(String... sqlMigrationSuffixes)
The file name suffixes for SQL migrations. (default: .sql) SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1_1__My_description.sql Multiple suffixes (like .sql,.pkg,.pkb) can be specified for easier compatibility with other tools such as editors with specific file associations.
-
setSqlMigrationSuffixes
public void setSqlMigrationSuffixes(Collection<String> sqlMigrationSuffixes)
The file name suffixes for SQL migrations. (default: .sql) SQL migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix, which using the defaults translates to V1_1__My_description.sql Multiple suffixes (like .sql,.pkg,.pkb) can be specified for easier compatibility with other tools such as editors with specific file associations.
-
setDataSource
public void setDataSource(@Nullable DataSource dataSource)
Sets the data source to use. Must have the necessary privileges to execute DDL.
-
setDataSource
public void setDataSource(@Nullable ConnectionProvider dataSource)
Sets the data source to use. Must have the necessary privileges to execute DDL.
-
setConnectRetries
public void setConnectRetries(int connectRetries)
The maximum number of retries when attempting to connect to the database. After each failed attempt, MigrateDB will wait 1 second before attempting to connect again, up to the maximum number of times specified by connectRetries. The interval between retries doubles with each subsequent attempt.
-
setConnectRetriesInterval
public void setConnectRetriesInterval(int connectRetriesInterval)
The maximum time between retries when attempting to connect to the database in seconds. This will cap the interval between connect retry to the value provided.
-
setInitSql
public void setInitSql(String initSql)
The SQL statements to run to initialize a new database connection immediately after opening it.
-
setBaselineVersion
public void setBaselineVersion(Version baselineVersion)
Sets the version to tag an existing schema with when executing baseline.
-
setBaselineVersionAsString
public void setBaselineVersionAsString(String baselineVersion)
Sets the version to tag an existing schema with when executing baseline.
-
setBaselineDescription
public void setBaselineDescription(String baselineDescription)
Sets the description to tag an existing schema with when executing baseline.
-
setBaselineOnMigrate
public void setBaselineOnMigrate(boolean baselineOnMigrate)
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table. This schema will then be baselined with thebaselineVersionbefore executing the migrations. Only migrations abovebaselineVersionwill then be applied.This is useful for initial MigrateDB production deployments on projects with an existing DB.
Be careful when enabling this as it removes the safety net that ensures MigrateDB does not migrate the wrong database in case of a configuration mistake!
-
setOutOfOrder
public void setOutOfOrder(boolean outOfOrder)
Allows migrations to be run "out of order". If you already have versions 1 and 3 applied, and now a version 2 is found, it will be applied too instead of being ignored.
-
setSkipExecutingMigrations
public void setSkipExecutingMigrations(boolean skipExecutingMigrations)
Whether MigrateDB should skip actually executing the contents of the migrations and only update the schema history table. This should be used when you have applied a migration manually (via executing the sql yourself, or via an IDE), and just want the schema history table to reflect this.Use in conjunction with
cherryPickto skip specific migrations instead of all pending ones.
-
setCallbacks
public void setCallbacks(Callback... callbacks)
Set the callbacks for lifecycle notifications.
-
setCallbacks
public void setCallbacks(Collection<Callback> callbacks)
Set the callbacks for lifecycle notifications.
-
setCallbacksAsClassNames
public void setCallbacksAsClassNames(String... callbacks)
Set the callbacks for lifecycle notifications.
-
setCallbacksAsClassNames
public void setCallbacksAsClassNames(Collection<String> callbacks)
Set the callbacks for lifecycle notifications.
-
useExtension
public void useExtension(MigrateDbExtension extension)
Enables a single MigrateDB extension.
-
useExtensions
public void useExtensions(Iterable<MigrateDbExtension> extensions)
Enables multiple MigrateDB extensions. This is mainly used to load extensions from theServiceLoaderfacility:config.useExtensions(ServiceLoader.load(MigrateDbExtension.class))
-
setSkipDefaultCallbacks
public void setSkipDefaultCallbacks(boolean skipDefaultCallbacks)
Whether MigrateDB should skip the default callbacks. If true, only custom callbacks are used.
-
setResolvers
public void setResolvers(MigrationResolver... resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.
-
setResolvers
public void setResolvers(Collection<MigrationResolver> resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.
-
setResolversAsClassNames
public void setResolversAsClassNames(String... resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.
-
setResolversAsClassNames
public void setResolversAsClassNames(Collection<String> resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.
-
setSkipDefaultResolvers
public void setSkipDefaultResolvers(boolean skipDefaultResolvers)
Whether MigrateDB should skip the default resolvers. If true, only custom resolvers are used.
-
setCreateSchemas
public void setCreateSchemas(boolean createSchemas)
Whether MigrateDB should attempt to create the schemas specified in the schemas property.
-
setOutputQueryResults
public void setOutputQueryResults(boolean outputQueryResults)
Whether MigrateDB should output a table with the results of queries when executing migrations.
-
setResourceProvider
public void setResourceProvider(ResourceProvider resourceProvider)
Set the custom ResourceProvider to be used to look up resources. If not set, the default strategy will be * used. (default: null)
-
setJavaMigrationClassProvider
public void setJavaMigrationClassProvider(ClassProvider<JavaMigration> javaMigrationClassProvider)
The custom ClassProvider to be used to look upJavaMigrationclasses. If not set, the default * strategy will be used. (default: null)
-
setLockRetryCount
public void setLockRetryCount(int lockRetryCount)
Sets the maximum number of retries when trying to obtain a lock. -1 indicates attempting to repeat indefinitely.
-
setFailOnMissingLocations
public void setFailOnMissingLocations(boolean failOnMissingLocations)
Whether to fail if a location specified in themigratedb.locationsoption doesn't exist
-
setLiberateOnMigrate
public void setLiberateOnMigrate(boolean liberateOnMigrate)
Whether theliberatecommand is automatically executed onmigrateif the schema history table does not exist, butoldTableexists. (Default:true)
-
setExtensionConfig
public <T extends ExtensionConfig> void setExtensionConfig(Class<T> extensionConfigType, T value)
Sets the extension config of typeT.
-
configure
public void configure(Configuration configuration)
Configure with the same values as this existing configuration.To use a custom ClassLoader, it must be passed to the constructor prior to calling this method.
-
configure
public void configure(Properties properties)
Configures MigrateDB with these properties. This overwrites any existing configuration. Property names are documented inPropertyNames. To use a custom ClassLoader, it must be passed to the MigrateDB constructor prior to calling this method. To support the configuration of extensions, those extensions must be activated viauseExtensionprior to calling this method.- Parameters:
properties- Properties used for configuration.- Throws:
MigrateDbException- if the configuration fails.
-
configure
public void configure(Map<String,String> props)
Configures MigrateDB with these properties. This overwrites any existing configuration. Property names are documented inPropertyNames. To use a custom ClassLoader, it must be passed to the MigrateDB constructor prior to calling this method. To support the configuration of extensions, those extensions must be activated viauseExtensionprior to calling this method.- Parameters:
props- Properties used for configuration.- Throws:
MigrateDbException- if the configuration fails.
-
-