Class ClassicConfiguration
- java.lang.Object
-
- org.flywaydb.core.api.configuration.ClassicConfiguration
-
- All Implemented Interfaces:
Configuration
public class ClassicConfiguration extends java.lang.Object implements Configuration
JavaBean-style configuration for Flyway. This is primarily meant for compatibility with scenarios where the new FluentConfiguration isn't an easy fit, such as Spring XML bean configuration.This configuration can then be passed to Flyway using the
new Flyway(Configuration)
constructor.
-
-
Constructor Summary
Constructors Constructor Description ClassicConfiguration()
Creates a new default configuration.ClassicConfiguration(java.lang.ClassLoader classLoader)
Creates a new default configuration with this classloader.ClassicConfiguration(Configuration configuration)
Creates a new configuration with the same values as this existing one.
-
Method Summary
Modifier and Type Method Description void
configure(java.util.Map<java.lang.String,java.lang.String> props)
Configures Flyway with these properties.void
configure(java.util.Properties properties)
Configures Flyway with these properties.void
configure(Configuration configuration)
Configure with the same values as this existing configuration.void
configureUsingEnvVars()
Configures Flyway using FLYWAY_* environment variables.java.lang.String
getBaselineDescription()
Retrieves the description to tag an existing schema with when executing baseline.MigrationVersion
getBaselineVersion()
Retrieves the version to tag an existing schema with when executing baseline.Callback[]
getCallbacks()
Gets the callbacks for lifecycle notifications.java.lang.ClassLoader
getClassLoader()
Retrieves the ClassLoader to use for loading migrations, resolvers, etc from the classpath.int
getConnectRetries()
The maximum number of retries when attempting to connect to the database.javax.sql.DataSource
getDataSource()
Retrieves the dataSource to use to access the database.java.lang.String
getDefaultSchema()
Retrieves the default schema managed by Flyway.java.io.OutputStream
getDryRunOutput()
The stream where to output the SQL statements of a migration dry run.java.nio.charset.Charset
getEncoding()
Retrieves the encoding of Sql migrations.java.lang.String[]
getErrorOverrides()
Rules for the built-in error handler that let you override specific SQL states and errors codes in order to force specific errors or warnings to be treated as debug messages, info messages, warnings or errors.java.lang.String
getInitSql()
The SQL statements to run to initialize a new database connection immediately after opening it.java.lang.String
getInstalledBy()
The username that will be recorded in the schema history table as having applied the migration.JavaMigration[]
getJavaMigrations()
The manually added Java-based migrations.java.lang.String
getLicenseKey()
Your Flyway license key (FL01...).Location[]
getLocations()
Retrieves the locations to scan recursively for migrations.java.lang.String
getPlaceholderPrefix()
Retrieves the prefix of every placeholder.java.util.Map<java.lang.String,java.lang.String>
getPlaceholders()
Retrieves the map of <placeholder, replacementValue> to apply to sql migration scripts.java.lang.String
getPlaceholderSuffix()
Retrieves the suffix of every placeholder.java.lang.String
getRepeatableSqlMigrationPrefix()
Retrieves the file name prefix for repeatable SQL migrations.MigrationResolver[]
getResolvers()
Retrieves the custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.java.lang.String[]
getSchemas()
Retrieves the schemas managed by Flyway.java.lang.String
getSqlMigrationPrefix()
The file name prefix for versioned SQL migrations.java.lang.String
getSqlMigrationSeparator()
Retrieves the file name separator for sql migrations.java.lang.String[]
getSqlMigrationSuffixes()
The file name suffixes for SQL migrations.java.lang.String
getTable()
Retrieves the name of the schema history table that will be used by Flyway.java.lang.String
getTablespace()
Retrieves the tablespace where to create the schema history table that will be used by Flyway.MigrationVersion
getTarget()
Gets the target version up to which Flyway should consider migrations.java.lang.String
getUndoSqlMigrationPrefix()
The file name prefix for undo SQL migrations.boolean
isBaselineOnMigrate()
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.boolean
isBatch()
Whether to batch SQL statements when executing them.boolean
isCleanDisabled()
Whether to disable clean.boolean
isCleanOnValidationError()
Whether to automatically call clean or not when a validation error occurs.boolean
isGroup()
Whether to group all pending migrations together in the same transaction when applying them (only recommended for databases with support for DDL transactions).boolean
isIgnoreFutureMigrations()
Ignore future migrations when reading the schema history table.boolean
isIgnoreIgnoredMigrations()
Ignore ignored migrations when reading the schema history table.boolean
isIgnoreMissingMigrations()
Ignore missing migrations when reading the schema history table.boolean
isIgnorePendingMigrations()
Ignore pending migrations when reading the schema history table.boolean
isMixed()
Whether to allow mixing transactional and non-transactional statements within the same migration.boolean
isOracleSqlplus()
Whether to Flyway's support for Oracle SQL*Plus commands should be activated.boolean
isOracleSqlplusWarn()
Whether Flyway should issue a warning instead of an error whenever it encounters an Oracle SQL*Plus statement it doesn't yet support.boolean
isOutOfOrder()
Allows migrations to be run "out of order".boolean
isPlaceholderReplacement()
Checks whether placeholders should be replaced.boolean
isSkipDefaultCallbacks()
Whether Flyway should skip the default callbacks.boolean
isSkipDefaultResolvers()
Whether Flyway should skip the default resolvers.boolean
isStream()
Whether to stream SQL migrations when executing them.boolean
isValidateOnMigrate()
Whether to automatically call validate or not when running migrate.boolean
outputQueryResults()
Whether Flyway should output a table with the results of queries when executing migrations.void
setBaselineDescription(java.lang.String baselineDescription)
Sets the description to tag an existing schema with when executing baseline.void
setBaselineOnMigrate(boolean baselineOnMigrate)
Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.void
setBaselineVersion(MigrationVersion baselineVersion)
Sets the version to tag an existing schema with when executing baseline.void
setBaselineVersionAsString(java.lang.String baselineVersion)
Sets the version to tag an existing schema with when executing baseline.void
setBatch(boolean batch)
Whether to batch SQL statements when executing them.void
setCallbacks(Callback... callbacks)
Set the callbacks for lifecycle notifications.void
setCallbacksAsClassNames(java.lang.String... callbacks)
Set the callbacks for lifecycle notifications.void
setCleanDisabled(boolean cleanDisabled)
Whether to disable clean.void
setCleanOnValidationError(boolean cleanOnValidationError)
Whether to automatically call clean or not when a validation error occurs.void
setConnectRetries(int connectRetries)
The maximum number of retries when attempting to connect to the database.void
setDataSource(java.lang.String url, java.lang.String user, java.lang.String password)
Sets the datasource to use.void
setDataSource(javax.sql.DataSource dataSource)
Sets the datasource to use.void
setDefaultSchema(java.lang.String schema)
Sets the default schema managed by Flyway.void
setDryRunOutput(java.io.OutputStream dryRunOutput)
Sets the stream where to output the SQL statements of a migration dry run.void
setDryRunOutputAsFile(java.io.File dryRunOutput)
Sets the file where to output the SQL statements of a migration dry run.void
setDryRunOutputAsFileName(java.lang.String dryRunOutputFileName)
Sets the file where to output the SQL statements of a migration dry run.void
setEncoding(java.nio.charset.Charset encoding)
Sets the encoding of Sql migrations.void
setEncodingAsString(java.lang.String encoding)
Sets the encoding of Sql migrations.void
setErrorOverrides(java.lang.String... errorOverrides)
Rules for the built-in error handler that let you override specific SQL states and errors codes in order to force specific errors or warnings to be treated as debug messages, info messages, warnings or errors.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).void
setIgnoreFutureMigrations(boolean ignoreFutureMigrations)
Whether to ignore future migrations when reading the schema history table.void
setIgnoreIgnoredMigrations(boolean ignoreIgnoredMigrations)
Ignore ignored migrations when reading the schema history table.void
setIgnoreMissingMigrations(boolean ignoreMissingMigrations)
Ignore missing migrations when reading the schema history table.void
setIgnorePendingMigrations(boolean ignorePendingMigrations)
Ignore pending migrations when reading the schema history table.void
setInitSql(java.lang.String initSql)
The SQL statements to run to initialize a new database connection immediately after opening it.void
setInstalledBy(java.lang.String installedBy)
The username that will be recorded in the schema history table as having applied the migration.void
setJavaMigrations(JavaMigration... javaMigrations)
The manually added Java-based migrations.void
setLicenseKey(java.lang.String licenseKey)
Your Flyway license key (FL01...).void
setLocations(Location... locations)
Sets the locations to scan recursively for migrations.void
setLocationsAsStrings(java.lang.String... locations)
Sets the locations to scan recursively for migrations.void
setMixed(boolean mixed)
Whether to allow mixing transactional and non-transactional statements within the same migration.void
setOracleSqlplus(boolean oracleSqlplus)
Whether to Flyway's support for Oracle SQL*Plus commands should be activated.void
setOracleSqlplusWarn(boolean oracleSqlplusWarn)
Whether Flyway should issue a warning instead of an error whenever it encounters an Oracle SQL*Plus statement it doesn't yet support.void
setOutOfOrder(boolean outOfOrder)
Allows migrations to be run "out of order".void
setPlaceholderPrefix(java.lang.String placeholderPrefix)
Sets the prefix of every placeholder.void
setPlaceholderReplacement(boolean placeholderReplacement)
Sets whether placeholders should be replaced.void
setPlaceholders(java.util.Map<java.lang.String,java.lang.String> placeholders)
Sets the placeholders to replace in sql migration scripts.void
setPlaceholderSuffix(java.lang.String placeholderSuffix)
Sets the suffix of every placeholder.void
setRepeatableSqlMigrationPrefix(java.lang.String repeatableSqlMigrationPrefix)
Sets the file name prefix for repeatable sql migrations.void
setResolvers(MigrationResolver... resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.void
setResolversAsClassNames(java.lang.String... resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.void
setSchemas(java.lang.String... schemas)
Sets the schemas managed by Flyway.void
setSkipDefaultCallbacks(boolean skipDefaultCallbacks)
Whether Flyway should skip the default callbacks.void
setSkipDefaultResolvers(boolean skipDefaultResolvers)
Whether Flyway should skip the default resolvers.void
setSqlMigrationPrefix(java.lang.String sqlMigrationPrefix)
Sets the file name prefix for sql migrations.void
setSqlMigrationSeparator(java.lang.String sqlMigrationSeparator)
Sets the file name separator for sql migrations.void
setSqlMigrationSuffixes(java.lang.String... sqlMigrationSuffixes)
The file name suffixes for SQL migrations.void
setStream(boolean stream)
Whether to stream SQL migrations when executing them.void
setTable(java.lang.String table)
Sets the name of the schema history table that will be used by Flyway.void
setTablespace(java.lang.String tablespace)
Sets the tablespace where to create the schema history table that will be used by Flyway.void
setTarget(MigrationVersion target)
Sets the target version up to which Flyway should consider migrations.void
setTargetAsString(java.lang.String target)
Sets the target version up to which Flyway should consider migrations.void
setUndoSqlMigrationPrefix(java.lang.String undoSqlMigrationPrefix)
Sets the file name prefix for undo SQL migrations.void
setValidateOnMigrate(boolean validateOnMigrate)
Whether to automatically call validate or not when running migrate.
-
-
-
Constructor Detail
-
ClassicConfiguration
public ClassicConfiguration()
Creates a new default configuration.
-
ClassicConfiguration
public ClassicConfiguration(java.lang.ClassLoader classLoader)
Creates a new default configuration with this classloader.- Parameters:
classLoader
- The ClassLoader to use for loading migrations, resolvers, etc from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
ClassicConfiguration
public ClassicConfiguration(Configuration configuration)
Creates a new configuration with the same values as this existing one.- Parameters:
configuration
- The configuration to use.
-
-
Method Detail
-
getLocations
public Location[] getLocations()
Description copied from interface:Configuration
Retrieves 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.- Specified by:
getLocations
in interfaceConfiguration
- Returns:
- Locations to scan recursively for migrations. (default: classpath:db/migration)
-
getEncoding
public java.nio.charset.Charset getEncoding()
Description copied from interface:Configuration
Retrieves the encoding of Sql migrations.- Specified by:
getEncoding
in interfaceConfiguration
- Returns:
- The encoding of Sql migrations. (default: UTF-8)
-
getDefaultSchema
public java.lang.String getDefaultSchema()
Description copied from interface:Configuration
Retrieves the default schema managed by Flyway. This schema name is case-sensitive. If not specified, but flyway.schemas is, we use the first schema in that list. In Flyway 7, you will need to specify this value and not rely on flyway.schemas (default: 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).
- Specified by:
getDefaultSchema
in interfaceConfiguration
- Returns:
- The schemas managed by Flyway. (default: The first schema specified in getSchemas(), and failing that the default schema for the database connection)
-
getSchemas
public java.lang.String[] getSchemas()
Description copied from interface:Configuration
Retrieves the schemas managed by Flyway. These schema names are case-sensitive.Consequences:
- Flyway will automatically attempt to create all these schemas, unless they already exist.
- The schemas will be cleaned in the order of this list.
- If Flyway created them, the schemas themselves will be dropped when cleaning.
- Specified by:
getSchemas
in interfaceConfiguration
- Returns:
- The schemas managed by Flyway. (default: The default schema for the database connection)
-
getTable
public java.lang.String getTable()
Description copied from interface:Configuration
Retrieves the name of the schema history table that will be used by Flyway.
By default (single-schema mode) the schema history table is placed in the default schema for the connection provided by the datasource.
When the flyway.schemas property is set (multi-schema mode), the schema history table is placed in the first schema of the list.
- Specified by:
getTable
in interfaceConfiguration
- Returns:
- The name of the schema history table that will be used by Flyway. (default: flyway_schema_history)
-
getTablespace
public java.lang.String getTablespace()
Description copied from interface:Configuration
Retrieves the tablespace where to create the schema history table that will be used by Flyway.
This setting is only relevant for databases that do support the notion of tablespaces. It's value is simply ignored for all others.
- Specified by:
getTablespace
in interfaceConfiguration
- Returns:
- The tablespace where to create the schema history table that will be used by Flyway. (default: The default tablespace for the database connection)
-
getTarget
public MigrationVersion getTarget()
Description copied from interface:Configuration
Gets the target version up to which Flyway 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
latest
.- Specified by:
getTarget
in interfaceConfiguration
- Returns:
- The target version up to which Flyway should consider migrations. Defaults to
latest
-
isPlaceholderReplacement
public boolean isPlaceholderReplacement()
Description copied from interface:Configuration
Checks whether placeholders should be replaced.- Specified by:
isPlaceholderReplacement
in interfaceConfiguration
- Returns:
- Whether placeholders should be replaced. (default: true)
-
getPlaceholders
public java.util.Map<java.lang.String,java.lang.String> getPlaceholders()
Description copied from interface:Configuration
Retrieves the map of <placeholder, replacementValue> to apply to sql migration scripts.- Specified by:
getPlaceholders
in interfaceConfiguration
- Returns:
- The map of <placeholder, replacementValue> to apply to sql migration scripts.
-
getPlaceholderPrefix
public java.lang.String getPlaceholderPrefix()
Description copied from interface:Configuration
Retrieves the prefix of every placeholder.- Specified by:
getPlaceholderPrefix
in interfaceConfiguration
- Returns:
- The prefix of every placeholder. (default: ${ )
-
getPlaceholderSuffix
public java.lang.String getPlaceholderSuffix()
Description copied from interface:Configuration
Retrieves the suffix of every placeholder.- Specified by:
getPlaceholderSuffix
in interfaceConfiguration
- Returns:
- The suffix of every placeholder. (default: } )
-
getSqlMigrationPrefix
public java.lang.String getSqlMigrationPrefix()
Description copied from interface:Configuration
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
- Specified by:
getSqlMigrationPrefix
in interfaceConfiguration
- Returns:
- The file name prefix for sql migrations. (default: V)
-
getRepeatableSqlMigrationPrefix
public java.lang.String getRepeatableSqlMigrationPrefix()
Description copied from interface:Configuration
Retrieves 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
- Specified by:
getRepeatableSqlMigrationPrefix
in interfaceConfiguration
- Returns:
- The file name prefix for repeatable sql migrations. (default: R)
-
getSqlMigrationSeparator
public java.lang.String getSqlMigrationSeparator()
Description copied from interface:Configuration
Retrieves 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
- Specified by:
getSqlMigrationSeparator
in interfaceConfiguration
- Returns:
- The file name separator for sql migrations. (default: __)
-
getSqlMigrationSuffixes
public java.lang.String[] getSqlMigrationSuffixes()
Description copied from interface:Configuration
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.
- Specified by:
getSqlMigrationSuffixes
in interfaceConfiguration
- Returns:
- The file name suffixes for SQL migrations.
-
getJavaMigrations
public JavaMigration[] getJavaMigrations()
Description copied from interface:Configuration
The manually added Java-based migrations. These are not Java-based migrations discovered through classpath scanning and instantiated by Flyway. 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.- Specified by:
getJavaMigrations
in interfaceConfiguration
- Returns:
- The manually added Java-based migrations. An empty array if none. (default: none)
-
isIgnoreMissingMigrations
public boolean isIgnoreMissingMigrations()
Description copied from interface:Configuration
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 Flyway 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, Flyway has no way to know it is missing and will mark it as future instead.- Specified by:
isIgnoreMissingMigrations
in interfaceConfiguration
- Returns:
true
to continue normally and log a warning,false
to fail fast with an exception. (default:false
)
-
isIgnoreIgnoredMigrations
public boolean isIgnoreIgnoredMigrations()
Description copied from interface:Configuration
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.- Specified by:
isIgnoreIgnoredMigrations
in interfaceConfiguration
- Returns:
true
to continue normally,false
to fail fast with an exception. (default:false
)
-
isIgnorePendingMigrations
public boolean isIgnorePendingMigrations()
Description copied from interface:Configuration
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.- Specified by:
isIgnorePendingMigrations
in interfaceConfiguration
- Returns:
true
to continue normally,false
to fail fast with an exception. (default:false
)
-
isIgnoreFutureMigrations
public boolean isIgnoreFutureMigrations()
Description copied from interface:Configuration
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 Flyway 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.- Specified by:
isIgnoreFutureMigrations
in interfaceConfiguration
- Returns:
true
to continue normally and log a warning,false
to fail fast with an exception. (default:true
)
-
isValidateOnMigrate
public boolean isValidateOnMigrate()
Description copied from interface:Configuration
Whether to automatically call validate or not when running migrate.- Specified by:
isValidateOnMigrate
in interfaceConfiguration
- Returns:
true
if validate should be called.false
if not. (default:true
)
-
isCleanOnValidationError
public boolean isCleanOnValidationError()
Description copied from interface:Configuration
Whether to automatically call clean or not when a validation error occurs.This is exclusively intended as a convenience for development. even though we strongly recommend not to change migration scripts once they have been checked into SCM and run, this provides a way of dealing with this case in a smooth manner. The database will be wiped clean automatically, ensuring that the next migration will bring you back to the state checked into SCM.
Warning ! Do not enable in production !
- Specified by:
isCleanOnValidationError
in interfaceConfiguration
- Returns:
true
if clean should be called.false
if not. (default:false
)
-
isCleanDisabled
public boolean isCleanDisabled()
Description copied from interface:Configuration
Whether to disable clean.This is especially useful for production environments where running clean can be quite a career limiting move.
- Specified by:
isCleanDisabled
in interfaceConfiguration
- Returns:
true
to disable clean.false
to leave it enabled. (default:false
)
-
getBaselineVersion
public MigrationVersion getBaselineVersion()
Description copied from interface:Configuration
Retrieves the version to tag an existing schema with when executing baseline.- Specified by:
getBaselineVersion
in interfaceConfiguration
- Returns:
- The version to tag an existing schema with when executing baseline. (default: 1)
-
getBaselineDescription
public java.lang.String getBaselineDescription()
Description copied from interface:Configuration
Retrieves the description to tag an existing schema with when executing baseline.- Specified by:
getBaselineDescription
in interfaceConfiguration
- Returns:
- The description to tag an existing schema with when executing baseline. (default: << Flyway Baseline >>)
-
isBaselineOnMigrate
public boolean isBaselineOnMigrate()
Description copied from interface:Configuration
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
baselineVersion
before executing the migrations. Only migrations abovebaselineVersion
will then be applied.This is useful for initial Flyway production deployments on projects with an existing DB.
Be careful when enabling this as it removes the safety net that ensures Flyway does not migrate the wrong database in case of a configuration mistake!
- Specified by:
isBaselineOnMigrate
in interfaceConfiguration
- Returns:
true
if baseline should be called on migrate for non-empty schemas,false
if not. (default:false
)
-
isOutOfOrder
public boolean isOutOfOrder()
Description copied from interface:Configuration
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.
- Specified by:
isOutOfOrder
in interfaceConfiguration
- Returns:
true
if outOfOrder migrations should be applied,false
if not. (default:false
)
-
getResolvers
public MigrationResolver[] getResolvers()
Description copied from interface:Configuration
Retrieves the custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.- Specified by:
getResolvers
in interfaceConfiguration
- Returns:
- The custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply. An empty array if none. (default: none)
-
isSkipDefaultResolvers
public boolean isSkipDefaultResolvers()
Description copied from interface:Configuration
Whether Flyway should skip the default resolvers. If true, only custom resolvers are used.- Specified by:
isSkipDefaultResolvers
in interfaceConfiguration
- Returns:
- Whether default built-in resolvers should be skipped. (default: false)
-
getDataSource
public javax.sql.DataSource getDataSource()
Description copied from interface:Configuration
Retrieves the dataSource to use to access the database. Must have the necessary privileges to execute ddl.- Specified by:
getDataSource
in interfaceConfiguration
- Returns:
- The dataSource to use to access the database. Must have the necessary privileges to execute ddl.
-
getConnectRetries
public int getConnectRetries()
Description copied from interface:Configuration
The maximum number of retries when attempting to connect to the database. After each failed attempt, Flyway will wait 1 second before attempting to connect again, up to the maximum number of times specified by connectRetries.- Specified by:
getConnectRetries
in interfaceConfiguration
- Returns:
- The maximum number of retries when attempting to connect to the database. (default: 0)
-
getInitSql
public java.lang.String getInitSql()
Description copied from interface:Configuration
The SQL statements to run to initialize a new database connection immediately after opening it.- Specified by:
getInitSql
in interfaceConfiguration
- Returns:
- The SQL statements. (default:
null
)
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Description copied from interface:Configuration
Retrieves the ClassLoader to use for loading migrations, resolvers, etc from the classpath.- Specified by:
getClassLoader
in interfaceConfiguration
- Returns:
- The ClassLoader to use for loading migrations, resolvers, etc from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
isMixed
public boolean isMixed()
Description copied from interface:Configuration
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.
- Specified by:
isMixed
in interfaceConfiguration
- Returns:
true
if mixed migrations should be allowed.false
if an error should be thrown instead. (default:false
)
-
getInstalledBy
public java.lang.String getInstalledBy()
Description copied from interface:Configuration
The username that will be recorded in the schema history table as having applied the migration.- Specified by:
getInstalledBy
in interfaceConfiguration
- Returns:
- The username or
null
for the current database user of the connection. (default:null
).
-
isGroup
public boolean isGroup()
Description copied from interface:Configuration
Whether to group all pending migrations together in the same transaction when applying them (only recommended for databases with support for DDL transactions).- Specified by:
isGroup
in interfaceConfiguration
- Returns:
true
if migrations should be grouped.false
if they should be applied individually instead. (default:false
)
-
getErrorOverrides
public java.lang.String[] getErrorOverrides()
Description copied from interface:Configuration
Rules for the built-in error handler that let you override specific SQL states and errors codes in order to force specific errors or warnings to be treated as debug messages, info messages, warnings or errors.Each error override has the following format:
STATE:12345:W
. It is a 5 character SQL state (or * to match all SQL states), a colon, the SQL error code (or * to match all SQL error codes), a colon and finally the desired behavior that should override the initial one.The following behaviors are accepted:
D
to force a debug messageD-
to force a debug message, but do not show the original sql state and error codeI
to force an info messageI-
to force an info message, but do not show the original sql state and error codeW
to force a warningW-
to force a warning, but do not show the original sql state and error codeE
to force an errorE-
to force an error, but do not show the original sql state and error code
Example 1: to force Oracle stored procedure compilation issues to produce errors instead of warnings, the following errorOverride can be used:
99999:17110:E
Example 2: to force SQL Server PRINT messages to be displayed as info messages (without SQL state and error code details) instead of warnings, the following errorOverride can be used:
S0001:0:I-
Example 3: to force all errors with SQL error code 123 to be treated as warnings instead, the following errorOverride can be used:
*:123:W
Flyway Pro and Flyway Enterprise only
- Specified by:
getErrorOverrides
in interfaceConfiguration
- Returns:
- The ErrorOverrides or an empty array if none are defined. (default: none)
-
getDryRunOutput
public java.io.OutputStream getDryRunOutput()
Description copied from interface:Configuration
The stream where to output the SQL statements of a migration dry run.null
if the SQL statements are executed against the database directly.Flyway Pro and Flyway Enterprise only
- Specified by:
getDryRunOutput
in interfaceConfiguration
- Returns:
- The stream or
null
if the SQL statements are executed against the database directly.
-
getLicenseKey
public java.lang.String getLicenseKey()
Description copied from interface:Configuration
Your Flyway license key (FL01...). Not yet a Flyway Pro or Enterprise Edition customer? Request your Flyway trial license key to try out Flyway Pro and Enterprise Edition features free for 30 days.Flyway Pro and Flyway Enterprise only
- Specified by:
getLicenseKey
in interfaceConfiguration
- Returns:
- Your Flyway license key.
-
outputQueryResults
public boolean outputQueryResults()
Whether Flyway should output a table with the results of queries when executing migrations.Flyway Pro and Flyway Enterprise only
- Specified by:
outputQueryResults
in interfaceConfiguration
- Returns:
true
to output the results table (default:true
)
-
setDryRunOutput
public void setDryRunOutput(java.io.OutputStream dryRunOutput)
Sets the stream where to output the SQL statements of a migration dry run.null
to execute the SQL statements directly against the database. The stream when be closing when Flyway finishes writing the output.Flyway Pro and Flyway Enterprise only
- Parameters:
dryRunOutput
- The output file ornull
to execute the SQL statements directly against the database.
-
setDryRunOutputAsFile
public void setDryRunOutputAsFile(java.io.File dryRunOutput)
Sets the file where to output the SQL statements of a migration dry run.null
to execute the SQL statements directly against the database. If the file specified is in a non-existent directory, Flyway will create all directories and parent directories as needed.Flyway Pro and Flyway Enterprise only
- Parameters:
dryRunOutput
- The output file ornull
to execute the SQL statements directly against the database.
-
setDryRunOutputAsFileName
public void setDryRunOutputAsFileName(java.lang.String dryRunOutputFileName)
Sets the file where to output the SQL statements of a migration dry run.null
to execute the SQL statements directly against the database. If the file specified is in a non-existent directory, Flyway will create all directories and parent directories as needed.Flyway Pro and Flyway Enterprise only
- Parameters:
dryRunOutputFileName
- The name of the output file ornull
to execute the SQL statements directly against the database.
-
setErrorOverrides
public void setErrorOverrides(java.lang.String... errorOverrides)
Rules for the built-in error handler that let you override specific SQL states and errors codes in order to force specific errors or warnings to be treated as debug messages, info messages, warnings or errors.Each error override has the following format:
STATE:12345:W
. It is a 5 character SQL state (or * to match all SQL states), a colon, the SQL error code (or * to match all SQL error codes), a colon and finally the desired behavior that should override the initial one.The following behaviors are accepted:
D
to force a debug messageD-
to force a debug message, but do not show the original sql state and error codeI
to force an info messageI-
to force an info message, but do not show the original sql state and error codeW
to force a warningW-
to force a warning, but do not show the original sql state and error codeE
to force an errorE-
to force an error, but do not show the original sql state and error code
Example 1: to force Oracle stored procedure compilation issues to produce errors instead of warnings, the following errorOverride can be used:
99999:17110:E
Example 2: to force SQL Server PRINT messages to be displayed as info messages (without SQL state and error code details) instead of warnings, the following errorOverride can be used:
S0001:0:I-
Example 3: to force all errors with SQL error code 123 to be treated as warnings instead, the following errorOverride can be used:
*:123:W
Flyway Pro and Flyway Enterprise only
- Parameters:
errorOverrides
- The ErrorOverrides or an empty array if none are defined. (default: none)
-
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).- Parameters:
group
-true
if migrations should be grouped.false
if they should be applied individually instead. (default:false
)
-
setInstalledBy
public void setInstalledBy(java.lang.String installedBy)
The username that will be recorded in the schema history table as having applied the migration.- Parameters:
installedBy
- The username ornull
for the current database user of the connection. (default:null
).
-
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.
- Parameters:
mixed
-true
if mixed migrations should be allowed.false
if an error should be thrown instead. (default:false
)
-
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 Flyway 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, Flyway has no way to know it is missing and will mark it as future instead.- Parameters:
ignoreMissingMigrations
-true
to continue normally and log a warning,false
to fail fast with an exception. (default:false
)
-
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.- Parameters:
ignoreIgnoredMigrations
-true
to continue normally,false
to fail fast with an exception. (default:false
)
-
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.- Parameters:
ignorePendingMigrations
-true
to continue normally,false
to fail fast with an exception. (default:false
)
-
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 Flyway 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.- Parameters:
ignoreFutureMigrations
-true
to continue normally and log a warning,false
to fail fast with an exception. (default:true
)
-
setValidateOnMigrate
public void setValidateOnMigrate(boolean validateOnMigrate)
Whether to automatically call validate or not when running migrate.- Parameters:
validateOnMigrate
-true
if validate should be called.false
if not. (default:true
)
-
setCleanOnValidationError
public void setCleanOnValidationError(boolean cleanOnValidationError)
Whether to automatically call clean or not when a validation error occurs.This is exclusively intended as a convenience for development. even though we strongly recommend not to change migration scripts once they have been checked into SCM and run, this provides a way of dealing with this case in a smooth manner. The database will be wiped clean automatically, ensuring that the next migration will bring you back to the state checked into SCM.
Warning ! Do not enable in production !
- Parameters:
cleanOnValidationError
-true
if clean should be called.false
if not. (default:false
)
-
setCleanDisabled
public void setCleanDisabled(boolean cleanDisabled)
Whether to disable clean.This is especially useful for production environments where running clean can be quite a career limiting move.
- Parameters:
cleanDisabled
-true
to disable clean.false
to leave it enabled. (default:false
)
-
setLocationsAsStrings
public void setLocationsAsStrings(java.lang.String... locations)
Sets 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.- Parameters:
locations
- Locations to scan recursively for migrations. (default: db/migration)
-
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 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.- Parameters:
locations
- Locations to scan recursively for migrations. (default: db/migration)
-
setEncoding
public void setEncoding(java.nio.charset.Charset encoding)
Sets the encoding of Sql migrations.- Parameters:
encoding
- The encoding of Sql migrations. (default: UTF-8)
-
setEncodingAsString
public void setEncodingAsString(java.lang.String encoding)
Sets the encoding of Sql migrations.- Parameters:
encoding
- The encoding of Sql migrations. (default: UTF-8)
-
setDefaultSchema
public void setDefaultSchema(java.lang.String schema)
Sets the default schema managed by Flyway. This schema name is case-sensitive. If not specified, but flyway.schemas is, we use the first schema in that list. In Flyway 7, you will need to specify this value and not rely on flyway.schemas (default: 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).
- Parameters:
schema
- The default schema managed by Flyway.
-
setSchemas
public void setSchemas(java.lang.String... schemas)
Sets the schemas managed by Flyway. These schema names are case-sensitive. (default: The value of getDefaultSchema(), or failing that the default schema for the database connection)Consequences:
- Flyway will automatically attempt to create all these schemas, unless they already exist.
- The schemas will be cleaned in the order of this list.
- If Flyway created them, the schemas themselves will be dropped when cleaning.
- Parameters:
schemas
- The schemas managed by Flyway. May not benull
. Must contain at least one element.
-
setTable
public void setTable(java.lang.String table)
Sets the name of the schema history table that will be used by Flyway.
By default (single-schema mode) the schema history table is placed in the default schema for the connection provided by the datasource.
When the flyway.schemas property is set (multi-schema mode), the schema history table is placed in the first schema of the list.
- Parameters:
table
- The name of the schema history table that will be used by Flyway. (default: flyway_schema_history)
-
setTablespace
public void setTablespace(java.lang.String tablespace)
Sets the tablespace where to create the schema history table that will be used by Flyway.
This setting is only relevant for databases that do support the notion of tablespaces. It's value is simply ignored for all others.
- Parameters:
tablespace
- The tablespace where to create the schema history table that will be used by Flyway. (default: The default tablespace for the database connection)
-
setTarget
public void setTarget(MigrationVersion target)
Sets the target version up to which Flyway 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
latest
.
-
setTargetAsString
public void setTargetAsString(java.lang.String target)
Sets the target version up to which Flyway 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
latest
.
-
setPlaceholderReplacement
public void setPlaceholderReplacement(boolean placeholderReplacement)
Sets whether placeholders should be replaced.- Parameters:
placeholderReplacement
- Whether placeholders should be replaced. (default: true)
-
setPlaceholders
public void setPlaceholders(java.util.Map<java.lang.String,java.lang.String> placeholders)
Sets the placeholders to replace in sql migration scripts.- Parameters:
placeholders
- The map of <placeholder, replacementValue> to apply to sql migration scripts.
-
setPlaceholderPrefix
public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
Sets the prefix of every placeholder.- Parameters:
placeholderPrefix
- The prefix of every placeholder. (default: ${ )
-
setPlaceholderSuffix
public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
Sets the suffix of every placeholder.- Parameters:
placeholderSuffix
- The suffix of every placeholder. (default: } )
-
setSqlMigrationPrefix
public void setSqlMigrationPrefix(java.lang.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
- Parameters:
sqlMigrationPrefix
- The file name prefix for sql migrations (default: V)
-
getUndoSqlMigrationPrefix
public java.lang.String getUndoSqlMigrationPrefix()
Description copied from interface:Configuration
The file name prefix for undo SQL migrations.Undo SQL migrations are responsible for undoing the effects of the versioned migration with the same version.
They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to U1.1__My_description.sql
Flyway Pro and Flyway Enterprise only
- Specified by:
getUndoSqlMigrationPrefix
in interfaceConfiguration
- Returns:
- The file name prefix for undo sql migrations. (default: U)
-
setUndoSqlMigrationPrefix
public void setUndoSqlMigrationPrefix(java.lang.String undoSqlMigrationPrefix)
Sets the file name prefix for undo SQL migrations. (default: U)Undo SQL migrations are responsible for undoing the effects of the versioned migration with the same version.
They have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to U1.1__My_description.sql
Flyway Pro and Flyway Enterprise only
- Parameters:
undoSqlMigrationPrefix
- The file name prefix for undo SQL migrations. (default: U)
-
setJavaMigrations
public void setJavaMigrations(JavaMigration... javaMigrations)
The manually added Java-based migrations. These are not Java-based migrations discovered through classpath scanning and instantiated by Flyway. 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.- Parameters:
javaMigrations
- The manually added Java-based migrations. An empty array if none. (default: none)
-
isStream
public boolean isStream()
Description copied from interface:Configuration
Whether to stream SQL migrations when executing them. Streaming doesn't load the entire migration in memory at once. Instead each statement is loaded individually. This is particularly useful for very large SQL migrations composed of multiple MB or even GB of reference data, as this dramatically reduces Flyway's memory consumption.Flyway Pro and Flyway Enterprise only
- Specified by:
isStream
in interfaceConfiguration
- Returns:
true
to stream SQL migrations.false
to fully loaded them in memory instead. (default:false
)
-
setStream
public void setStream(boolean stream)
Whether to stream SQL migrations when executing them. Streaming doesn't load the entire migration in memory at once. Instead each statement is loaded individually. This is particularly useful for very large SQL migrations composed of multiple MB or even GB of reference data, as this dramatically reduces Flyway's memory consumption.Flyway Pro and Flyway Enterprise only
- Parameters:
stream
-true
to stream SQL migrations.false
to fully loaded them in memory instead. (default:false
)
-
isBatch
public boolean isBatch()
Description copied from interface:Configuration
Whether to batch SQL statements when executing them. Batching can save up to 99 percent of network roundtrips by sending up to 100 statements at once over the network to the database, instead of sending each statement individually. This is particularly useful for very large SQL migrations composed of multiple MB or even GB of reference data, as this can dramatically reduce the network overhead. This is supported for INSERT, UPDATE, DELETE, MERGE and UPSERT statements. All other statements are automatically executed without batching.Flyway Pro and Flyway Enterprise only
- Specified by:
isBatch
in interfaceConfiguration
- Returns:
true
to batch SQL statements.false
to execute them individually instead. (default:false
)
-
setBatch
public void setBatch(boolean batch)
Whether to batch SQL statements when executing them. Batching can save up to 99 percent of network roundtrips by sending up to 100 statements at once over the network to the database, instead of sending each statement individually. This is particularly useful for very large SQL migrations composed of multiple MB or even GB of reference data, as this can dramatically reduce the network overhead. This is supported for INSERT, UPDATE, DELETE, MERGE and UPSERT statements. All other statements are automatically executed without batching.Flyway Pro and Flyway Enterprise only
- Parameters:
batch
-true
to batch SQL statements.false
to execute them individually instead. (default:false
)
-
setRepeatableSqlMigrationPrefix
public void setRepeatableSqlMigrationPrefix(java.lang.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
- Parameters:
repeatableSqlMigrationPrefix
- The file name prefix for repeatable sql migrations (default: R)
-
setSqlMigrationSeparator
public void setSqlMigrationSeparator(java.lang.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
- Parameters:
sqlMigrationSeparator
- The file name separator for sql migrations (default: __)
-
setSqlMigrationSuffixes
public void setSqlMigrationSuffixes(java.lang.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.
- Parameters:
sqlMigrationSuffixes
- The file name suffixes for SQL migrations.
-
setDataSource
public void setDataSource(javax.sql.DataSource dataSource)
Sets the datasource to use. Must have the necessary privileges to execute ddl.- Parameters:
dataSource
- The datasource to use. Must have the necessary privileges to execute ddl.
-
setDataSource
public void setDataSource(java.lang.String url, java.lang.String user, java.lang.String password)
Sets the datasource to use. Must have the necessary privileges to execute ddl.To use a custom ClassLoader, setClassLoader() must be called prior to calling this method.
- Parameters:
url
- The JDBC URL of the database.user
- The user of the database.password
- The password of the database.
-
setConnectRetries
public void setConnectRetries(int connectRetries)
The maximum number of retries when attempting to connect to the database. After each failed attempt, Flyway will wait 1 second before attempting to connect again, up to the maximum number of times specified by connectRetries.- Parameters:
connectRetries
- The maximum number of retries (default: 0).
-
setInitSql
public void setInitSql(java.lang.String initSql)
The SQL statements to run to initialize a new database connection immediately after opening it.- Parameters:
initSql
- The SQL statements. (default:null
)
-
setBaselineVersion
public void setBaselineVersion(MigrationVersion baselineVersion)
Sets the version to tag an existing schema with when executing baseline.- Parameters:
baselineVersion
- The version to tag an existing schema with when executing baseline. (default: 1)
-
setBaselineVersionAsString
public void setBaselineVersionAsString(java.lang.String baselineVersion)
Sets the version to tag an existing schema with when executing baseline.- Parameters:
baselineVersion
- The version to tag an existing schema with when executing baseline. (default: 1)
-
setBaselineDescription
public void setBaselineDescription(java.lang.String baselineDescription)
Sets the description to tag an existing schema with when executing baseline.- Parameters:
baselineDescription
- The description to tag an existing schema with when executing baseline. (default: << Flyway 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 the
baselineVersion
before executing the migrations. Only migrations abovebaselineVersion
will then be applied.This is useful for initial Flyway production deployments on projects with an existing DB.
Be careful when enabling this as it removes the safety net that ensures Flyway does not migrate the wrong database in case of a configuration mistake!
- Parameters:
baselineOnMigrate
-true
if baseline should be called on migrate for non-empty schemas,false
if not. (default:false
)
-
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.
- Parameters:
outOfOrder
-true
if outOfOrder migrations should be applied,false
if not. (default:false
)
-
getCallbacks
public Callback[] getCallbacks()
Gets the callbacks for lifecycle notifications.- Specified by:
getCallbacks
in interfaceConfiguration
- Returns:
- The callbacks for lifecycle notifications. An empty array if none. (default: none)
-
isSkipDefaultCallbacks
public boolean isSkipDefaultCallbacks()
Description copied from interface:Configuration
Whether Flyway should skip the default callbacks. If true, only custom callbacks are used.- Specified by:
isSkipDefaultCallbacks
in interfaceConfiguration
- Returns:
- Whether default built-in callbacks should be skipped. (default: false)
-
setCallbacks
public void setCallbacks(Callback... callbacks)
Set the callbacks for lifecycle notifications.- Parameters:
callbacks
- The callbacks for lifecycle notifications. (default: none)
-
setCallbacksAsClassNames
public void setCallbacksAsClassNames(java.lang.String... callbacks)
Set the callbacks for lifecycle notifications.- Parameters:
callbacks
- The fully qualified class names of the callbacks for lifecycle notifications. (default: none)
-
setSkipDefaultCallbacks
public void setSkipDefaultCallbacks(boolean skipDefaultCallbacks)
Whether Flyway should skip the default callbacks. If true, only custom callbacks are used.- Parameters:
skipDefaultCallbacks
- Whether default built-in callbacks should be skipped.(default: false)
-
setResolvers
public void setResolvers(MigrationResolver... resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.- Parameters:
resolvers
- The custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply. (default: empty list)
-
setResolversAsClassNames
public void setResolversAsClassNames(java.lang.String... resolvers)
Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.- Parameters:
resolvers
- The fully qualified class names of the custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply. (default: empty list)
-
setSkipDefaultResolvers
public void setSkipDefaultResolvers(boolean skipDefaultResolvers)
Whether Flyway should skip the default resolvers. If true, only custom resolvers are used.- Parameters:
skipDefaultResolvers
- Whether default built-in resolvers should be skipped.(default: false)
-
isOracleSqlplus
public boolean isOracleSqlplus()
Description copied from interface:Configuration
Whether to Flyway's support for Oracle SQL*Plus commands should be activated.Flyway Pro and Flyway Enterprise only
- Specified by:
isOracleSqlplus
in interfaceConfiguration
- Returns:
true
to active SQL*Plus support.false
to fail fast instead. (default:false
)
-
setOracleSqlplus
public void setOracleSqlplus(boolean oracleSqlplus)
Whether to Flyway's support for Oracle SQL*Plus commands should be activated.Flyway Pro and Flyway Enterprise only
- Parameters:
oracleSqlplus
-true
to active SQL*Plus support.false
to fail fast instead. (default:false
)
-
isOracleSqlplusWarn
public boolean isOracleSqlplusWarn()
Description copied from interface:Configuration
Whether Flyway should issue a warning instead of an error whenever it encounters an Oracle SQL*Plus statement it doesn't yet support.Flyway Pro and Flyway Enterprise only
- Specified by:
isOracleSqlplusWarn
in interfaceConfiguration
- Returns:
true
to issue a warning.false
to fail fast instead. (default:false
)
-
setOracleSqlplusWarn
public void setOracleSqlplusWarn(boolean oracleSqlplusWarn)
Whether Flyway should issue a warning instead of an error whenever it encounters an Oracle SQL*Plus statement it doesn't yet support.Flyway Pro and Flyway Enterprise only
- Parameters:
oracleSqlplusWarn
-true
to issue a warning.false
to fail fast instead. (default:false
)
-
setLicenseKey
public void setLicenseKey(java.lang.String licenseKey)
Your Flyway license key (FL01...). Not yet a Flyway Pro or Enterprise Edition customer? Request your Flyway trial license key to try out Flyway Pro and Enterprise Edition features free for 30 days.Flyway Pro and Flyway Enterprise only
- Parameters:
licenseKey
- Your Flyway license key.
-
configure
public void configure(Configuration configuration)
Configure with the same values as this existing configuration.- Parameters:
configuration
- The configuration to use.
-
configure
public void configure(java.util.Properties properties)
Configures Flyway with these properties. This overwrites any existing configuration. Property names are documented in the flyway maven plugin.To use a custom ClassLoader, setClassLoader() must be called prior to calling this method.
- Parameters:
properties
- Properties used for configuration.- Throws:
FlywayException
- when the configuration failed.
-
configure
public void configure(java.util.Map<java.lang.String,java.lang.String> props)
Configures Flyway with these properties. This overwrites any existing configuration. Property names are documented in the flyway maven plugin.To use a custom ClassLoader, it must be passed to the Flyway constructor prior to calling this method.
- Parameters:
props
- Properties used for configuration.- Throws:
FlywayException
- when the configuration failed.
-
configureUsingEnvVars
public void configureUsingEnvVars()
Configures Flyway using FLYWAY_* environment variables.
-
-