Class FluentConfiguration
- All Implemented Interfaces:
Configuration
new Flyway(Configuration)
constructor.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbaselineDescription
(String baselineDescription) Sets the description to tag an existing schema with when executing baseline.baselineOnMigrate
(boolean baselineOnMigrate) Whether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table.baselineVersion
(String baselineVersion) Sets the version to tag an existing schema with when executing baseline.baselineVersion
(MigrationVersion baselineVersion) Sets the version to tag an existing schema with when executing baseline.batch
(boolean batch) Whether to batch SQL statements when executing them.Set the callbacks for lifecycle notifications.Set the callbacks for lifecycle notifications.cleanDisabled
(boolean cleanDisabled) Whether to disable clean.cleanOnValidationError
(boolean cleanOnValidationError) Whether to automatically call clean or not when a validation error occurs.configuration
(Map<String, String> props) Configures Flyway with these properties.configuration
(Properties properties) Configures Flyway with these properties.configuration
(Configuration configuration) Configure with the same values as this existing configuration.connectRetries
(int connectRetries) The maximum number of retries when attempting to connect to the database.connectRetriesInterval
(int connectRetriesInterval) The maximum time between retries when attempting to connect to the database in seconds.org.flywaydb.core.ProgressLogger
createProgress
(String operationName) createSchemas
(boolean createSchemas) Whether Flyway should attempt to create the schemas specified in the schemas propertydataSource
(String url, String user, String password) Sets the datasource to use.dataSource
(DataSource dataSource) Sets the datasource to use.defaultSchema
(String schema) Sets the default schema managed by Flyway.detectEncoding
(boolean detectEncoding) Whether Flyway should try to automatically detect SQL migration file encodingSets the JDBC driver to use.dryRunOutput
(File dryRunOutput) Sets the file where to output the SQL statements of a migration dry run.dryRunOutput
(OutputStream dryRunOutput) Sets the stream where to output the SQL statements of a migration dry run.dryRunOutput
(String dryRunOutputFileName) Sets the file where to output the SQL statements of a migration dry run.Sets the encoding of SQL migrations.Sets the encoding of SQL migrations.environment
(String environment) envVars()
Configures Flyway using FLYWAY_* environment variables.errorOverrides
(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.executeInTransaction
(boolean executeInTransaction) Sets whether SQL should be executed within a transaction.failOnMissingLocations
(boolean failOnMissingLocations) Whether to fail if a location specified in the flyway.locations option doesn't existRetrieves the description to tag an existing schema with when executing baseline.Retrieves the version to tag an existing schema with when executing baseline.Gets DataSources for all the environmentsGets the connection environments that have already been resolved from this configurationCallback[]
Gets the callbacks for lifecycle notifications.Gets the migrations that Flyway should consider when migrating or undoing.Retrieves the ClassLoader to use for loading migrations, resolvers, etc.int
The maximum number of retries when attempting to connect to the database.int
The maximum time between retries when attempting to connect to the database in seconds.Get the name of the current environmentorg.flywaydb.core.internal.database.DatabaseType
Get the Database type determined by the URL or DatasourceRetrieves the dataSource to use to access the database.The default schema managed by Flyway.The JDBC driver of the configurationThe stream where to output the SQL statements of a migration dry run.Retrieves the encoding of Sql migrations.String[]
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.Ignore migrations that match this comma-separated list of patterns when validating migrations.The SQL statements to run to initialize a new database connection immediately after opening it.The username that will be recorded in the schema history table as having applied the migration.Retrieves the custom ClassProvider to be used to look upJavaMigration
classes.The manually added Java-based migrations.Properties to pass to the JDBC driver object Flyway Teams onlyThe path to the Kerberos config file.Location[]
Retrieves the locations to scan recursively for migrations.int
The maximum number of retries when trying to obtain a lock.String[]
The loggers Flyway should use.org.flywaydb.core.internal.configuration.models.ConfigurationModel
Retrieves the password used to construct the dataSource.Retrieves the prefix of every placeholder.Retrieves the map of <placeholder, replacementValue> to apply to sql migration scripts.Retrieves the separator of default placeholders.Retrieves the suffix of every placeholder.org.flywaydb.core.internal.plugin.PluginRegister
Retrieves the file name prefix for repeatable SQL migrations.Get the filename of generated reportsorg.flywaydb.core.internal.configuration.models.ResolvedEnvironment
getResolvedEnvironment
(String envName, org.flywaydb.core.internal.configuration.resolvers.ProvisionerMode provisionerMode, org.flywaydb.core.ProgressLogger progress) Retrieves the custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.Retrieves the custom ResourceProvider to be used to look up resources.String[]
The schemas managed by Flyway.Retrieves the prefix of every script placeholder.Retrieves the suffix of every script placeholder.The file name prefix for versioned SQL migrations.Retrieves the file name separator for sql migrations.String[]
The file name suffixes for SQL migrations.getTable()
Retrieves the name of the schema history table that will be used by Flyway.The tablespace where to create the schema history table that will be used by Flyway.Gets the target version up to which Flyway should consider migrations.getUrl()
Retrieves the url used to construct the dataSource.getUser()
Retrieves the user used to construct the dataSource.group
(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).ignoreMigrationPatterns
(String... ignoreMigrationPatterns) Ignore migrations that match this comma-separated list of patterns when validating migrations.ignoreMigrationPatterns
(ValidatePattern... ignoreMigrationPatterns) Ignore migrations that match this array of ValidatePatterns when validating migrations.The SQL statements to run to initialize a new database connection immediately after opening it.installedBy
(String installedBy) The username that will be recorded in the schema history table as having applied the migration.boolean
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
Whether to disable clean.boolean
Whether to automatically call clean or not when a validation error occurs.boolean
Whether Flyway should attempt to create the schemas specified in the schemas property.boolean
Whether Flyway should try to automatically detect SQL migration file encodingboolean
Checks whether SQL is executed in a transaction.boolean
Whether to fail if a location specified in the flyway.locations option doesn't existboolean
Whether to fail if no migration with the configured target version exists (default:true
)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
isMixed()
Whether to allow mixing transactional and non-transactional statements within the same migration.boolean
Allows migrations to be run "out of order".boolean
Whether Flyway should output a table with the results of queries when executing migrations.boolean
Checks whether placeholders should be replaced.boolean
boolean
Whether Flyway should skip the default callbacks.boolean
Whether Flyway should skip the default resolvers.boolean
Whether Flyway should skip actually executing the contents of the migrations and only update the schema history table.boolean
isStream()
Whether to stream SQL migrations when executing them.boolean
Whether to validate migrations and callbacks whose scripts do not obey the correct naming convention.boolean
Whether to automatically call validate or not when running migrate.javaMigrationClassProvider
(ClassProvider<JavaMigration> javaMigrationClassProvider) Custom ClassProvider to be used to look upJavaMigration
classes.javaMigrations
(JavaMigration... javaMigrations) The manually added Java-based migrations.jdbcProperties
(Map<String, String> jdbcProperties) Properties to pass to the JDBC driver objectkerberosConfigFile
(String kerberosConfigFile) When connecting to a Kerberos service to authenticate, the path to the Kerberos config file.load()
Load configuration files from the default locations: $installationDir$/conf/flyway.conf $user.home$/flyway.conf $workingDirectory$/flyway.conf The configuration files must be encoded with UTF-8.loadDefaultConfigurationFiles
(String encoding) Load configuration files from the default locations: $installationDir$/conf/flyway.conf $user.home$/flyway.conf $workingDirectory$/flyway.confSets the locations to scan recursively for migrations.Sets the locations to scan recursively for migrations.lockRetryCount
(int lockRetryCount) The loggers Flyway should use.mixed
(boolean mixed) Whether to allow mixing transactional and non-transactional statements within the same migration.outOfOrder
(boolean outOfOrder) Allows migrations to be run "out of order".outputQueryResults
(boolean outputQueryResults) Whether Flyway should output a table with the results of queries when executing migrations.placeholderPrefix
(String placeholderPrefix) Sets the prefix of every placeholder.placeholderReplacement
(boolean placeholderReplacement) Sets whether placeholders should be replaced.placeholders
(Map<String, String> placeholders) Sets the placeholders to replace in sql migration scripts.placeholderSeparator
(String placeholderSeparator) Sets the separator of default placeholders.placeholderSuffix
(String placeholderSuffix) Sets the suffix of every placeholder.repeatableSqlMigrationPrefix
(String repeatableSqlMigrationPrefix) Sets the file name prefix for repeatable sql migrations.reportFilename
(String reportFilename) Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.resolvers
(MigrationResolver... resolvers) Sets custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.resourceProvider
(ResourceProvider resourceProvider) Custom ResourceProvider to be used to look up resources.Sets the schemas managed by Flyway.scriptPlaceholderPrefix
(String scriptPlaceholderPrefix) Sets the prefix of every script placeholder.scriptPlaceholderSuffix
(String scriptPlaceholderSuffix) Sets the suffix of every script placeholder.skipDefaultCallbacks
(boolean skipDefaultCallbacks) Whether Flyway should skip the default callbacks.skipDefaultResolvers
(boolean skipDefaultResolvers) Whether Flyway should skip the default resolvers.skipExecutingMigrations
(boolean skipExecutingMigrations) Whether Flyway should skip actually executing the contents of the migrations and only update the schema history table.sqlMigrationPrefix
(String sqlMigrationPrefix) Sets the file name prefix for sql migrations.sqlMigrationSeparator
(String sqlMigrationSeparator) Sets the file name separator for sql migrations.sqlMigrationSuffixes
(String... sqlMigrationSuffixes) The file name suffixes for SQL migrations.stream
(boolean stream) Whether to stream SQL migrations when executing them.Sets the name of the schema history table that will be used by Flyway.tablespace
(String tablespace) Sets the tablespace where to create the schema history table that will be used by Flyway.Sets the target version up to which Flyway should consider migrations.target
(MigrationVersion target) Sets the target version up to which Flyway should consider migrations.validateMigrationNaming
(boolean validateMigrationNaming) Whether to validate migrations and callbacks whose scripts do not obey the correct naming convention.validateOnMigrate
(boolean validateOnMigrate) Whether to automatically call validate or not when running migrate.workingDirectory
(String workingDirectory)
-
Constructor Details
-
FluentConfiguration
public FluentConfiguration() -
FluentConfiguration
- Parameters:
classLoader
- The ClassLoader to use for loading migrations, resolvers, etc from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
-
Method Details
-
load
- Returns:
- The new fully-configured Flyway instance.
-
configuration
Configure with the same values as this existing configuration. -
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 Teams only- Parameters:
dryRunOutput
- The output file ornull
to execute the SQL statements directly against the database.
-
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 Teams only- Parameters:
dryRunOutput
- The output file ornull
to execute the SQL statements directly against the database.
-
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. Paths starting with s3: point to a bucket in AWS S3, which must exist. They are in the format s3:(/optionalfolder/subfolder)/filename.sql Paths starting with gcs: point to a bucket in Google Cloud Storage, which must exist. They are in the format gcs: (/optionalfolder/subfolder)/filename.sql Flyway Teams only - Parameters:
dryRunOutputFileName
- The name of the output file ornull
to execute the SQL statements directly against the database.
-
reportFilename
-
environment
-
workingDirectory
-
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:
Flyway Teams only*:123:W
- Parameters:
errorOverrides
- The ErrorOverrides or an empty array if none are defined. (default: none)
-
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
)
-
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
).
-
loggers
The loggers Flyway should use. Valid options are:- auto: Auto detect the logger (default behavior)
- console: Use stdout/stderr (only available when using the CLI)
- slf4j: Use the slf4j logger
- log4j2: Use the log4j2 logger
- apache-commons: Use the Apache Commons logger
-
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
)
-
ignoreMigrationPatterns
Ignore migrations that match this comma-separated list of patterns when validating migrations. Each pattern is of the form: See https://documentation.red-gate.com/fd/ignore-migration-patterns-184127507.html for full details Example: repeatable:missing,versioned:pending,*:failed Flyway Teams only -
ignoreMigrationPatterns
Ignore migrations that match this array of ValidatePatterns when validating migrations. See https://documentation.red-gate.com/fd/ignore-migration-patterns-184127507.html for full details Flyway Teams only -
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.- Parameters:
validateMigrationNaming
-false
to continue normally,true
to fail fast with an exception. (default:false
)
-
validateOnMigrate
Whether to automatically call validate or not when running migrate.- Parameters:
validateOnMigrate
-true
if validate should be called.false
if not. (default:true
)
-
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
)
-
cleanDisabled
Whether to disable clean. This is especially useful for production environments where running clean can be a career limiting move.- Parameters:
cleanDisabled
-true
to disable clean.false
to be able to clean. (default:true
)
-
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.- Parameters:
locations
- Locations to scan recursively for migrations. (default: db/migration)
-
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.- Parameters:
locations
- Locations to scan recursively for migrations. (default: db/migration)
-
encoding
Sets the encoding of SQL migrations.- Parameters:
encoding
- The encoding of SQL migrations. (default: UTF-8)
-
encoding
Sets the encoding of SQL migrations.- Parameters:
encoding
- The encoding of SQL migrations. (default: UTF-8)
-
executeInTransaction
Sets whether SQL should be executed within a transaction.- Parameters:
executeInTransaction
-true
to enable execution of SQL in a transaction,false
otherwise
-
detectEncoding
Whether Flyway should try to automatically detect SQL migration file encoding- Parameters:
detectEncoding
-true
to enable auto detection,false
otherwise Flyway Teams only
-
defaultSchema
Sets the default schema managed by Flyway. This schema name is case-sensitive. If not specified, but schemas is, Flyway uses the first schema in that list. If that is also not specified, Flyway 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).
- Parameters:
schema
- The default schema managed by Flyway, which is where the schema history table will reside.
-
schemas
Sets the schemas managed by Flyway. These schema names are case-sensitive. If not specified, Flyway uses the default schema for the database connection. If defaultSchema is not specified, then the first of this list also acts as the default schema.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.
-
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, or in the schema specified to flyway.defaultSchema.- Parameters:
table
- The name of the schema history table that will be used by Flyway. (default: flyway_schema_history)
-
tablespace
Sets the tablespace where to create the schema history table that will be used by Flyway. If not specified, Flyway 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.- Parameters:
tablespace
- The tablespace where to create the schema history table that will be used by Flyway.
-
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 versionnext
: The next version of the schema, as defined by the first pending migration
latest
. -
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- <version>? (end with a '?'): Instructs Flyway not to fail if the target version doesn't exist. In this case, Flyway will go up to but not beyond the specified target (default: fail if the target version doesn't exist) Flyway Teams only
latest
. -
placeholderReplacement
Sets whether placeholders should be replaced.- Parameters:
placeholderReplacement
- Whether placeholders should be replaced. (default: true)
-
placeholders
Sets the placeholders to replace in sql migration scripts.- Parameters:
placeholders
- The map of <placeholder, replacementValue> to apply to sql migration scripts.
-
placeholderPrefix
Sets the prefix of every placeholder.- Parameters:
placeholderPrefix
- The prefix of every placeholder. (default: ${ )
-
placeholderSuffix
Sets the suffix of every placeholder.- Parameters:
placeholderSuffix
- The suffix of every placeholder. (default: } )
-
placeholderSeparator
Sets the separator of default placeholders.- Parameters:
placeholderSeparator
- The separator of default placeholders. (default: : )
-
scriptPlaceholderPrefix
Sets the prefix of every script placeholder.- Parameters:
scriptPlaceholderPrefix
- The prefix of every placeholder. (default: FP__ )
-
scriptPlaceholderSuffix
Sets the suffix of every script placeholder.- Parameters:
scriptPlaceholderSuffix
- The suffix of every script placeholder. (default: __ )
-
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)
-
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)
-
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: __)
-
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.
-
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)
-
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.
-
dataSource
Sets the datasource to use. Must have the necessary privileges to execute DDL.- Parameters:
url
- The JDBC URL of the database.user
- The user of the database.password
- The password of the database.
-
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. The interval between retries doubles with each subsequent attempt.- Parameters:
connectRetries
- The maximum number of retries (default: 0).
-
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.- Parameters:
connectRetriesInterval
- The maximum time between retries in seconds (default: 120).
-
initSql
The SQL statements to run to initialize a new database connection immediately after opening it.- Parameters:
initSql
- The SQL statements. (default:null
)
-
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)
-
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)
-
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 >>)
-
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 thebaselineVersion
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
)
-
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
)
-
skipExecutingMigrations
Whether Flyway 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 withcherryPick
to skip specific migrations instead of all pending ones. -
callbacks
Set the callbacks for lifecycle notifications.- Parameters:
callbacks
- The callbacks for lifecycle notifications. (default: none)
-
callbacks
Set the callbacks for lifecycle notifications.- Parameters:
callbacks
- The fully qualified class names, or full qualified package to scan, of the callbacks for lifecycle notifications. (default: none)
-
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)
-
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)
-
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)
-
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)
-
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 Teams only- Parameters:
stream
-true
to stream SQL migrations.false
to fully loaded them in memory instead. (default:false
)
-
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 Teams only- Parameters:
batch
-true
to batch SQL statements.false
to execute them individually instead. (default:false
)
-
lockRetryCount
-
jdbcProperties
Properties to pass to the JDBC driver object- Parameters:
jdbcProperties
- The properties to pass to the JDBC driver object
-
kerberosConfigFile
When connecting to a Kerberos service to authenticate, the path to the Kerberos config file. Flyway Teams only- Parameters:
kerberosConfigFile
- The path to the Kerberos config file
-
resourceProvider
Custom ResourceProvider to be used to look up resources. If not set, the default strategy will be used.- Parameters:
resourceProvider
- Custom ResourceProvider to be used to look up resources
-
javaMigrationClassProvider
public FluentConfiguration javaMigrationClassProvider(ClassProvider<JavaMigration> javaMigrationClassProvider) Custom ClassProvider to be used to look upJavaMigration
classes. If not set, the default strategy will be used.- Parameters:
javaMigrationClassProvider
- Custom ClassProvider to be used to look upJavaMigration
classes.
-
outputQueryResults
Whether Flyway should output a table with the results of queries when executing migrations. Flyway Teams only- Parameters:
outputQueryResults
-true
to output a table with the results of queries when executing migrations. (default:true
)
-
configuration
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.
-
configuration
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.
-
loadDefaultConfigurationFiles
Load configuration files from the default locations: $installationDir$/conf/flyway.conf $user.home$/flyway.conf $workingDirectory$/flyway.conf The configuration files must be encoded with UTF-8.- Throws:
FlywayException
- When the configuration failed.
-
loadDefaultConfigurationFiles
Load configuration files from the default locations: $installationDir$/conf/flyway.conf $user.home$/flyway.conf $workingDirectory$/flyway.conf- Parameters:
encoding
- The conf file encoding.- Throws:
FlywayException
- When the configuration failed.
-
createSchemas
Whether Flyway should attempt to create the schemas specified in the schemas property- Parameters:
createSchemas
-
-
envVars
Configures Flyway using FLYWAY_* environment variables.- Throws:
FlywayException
- When the configuration failed.
-
failOnMissingLocations
Whether to fail if a location specified in the flyway.locations option doesn't exist- Returns:
-
driver
Sets the JDBC driver to use. Must match the driver for the database type in the url.- Parameters:
driver
- The name of the JDBC driver of the database.
-
getModernConfig
public org.flywaydb.core.internal.configuration.models.ConfigurationModel getModernConfig()- Specified by:
getModernConfig
in interfaceConfiguration
-
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() )
-
getPluginRegister
public org.flywaydb.core.internal.plugin.PluginRegister getPluginRegister()- Specified by:
getPluginRegister
in interfaceConfiguration
-
getReportFilename
Description copied from interface:Configuration
Get the filename of generated reports- Specified by:
getReportFilename
in interfaceConfiguration
- Returns:
- report filename;
-
isReportEnabled
public boolean isReportEnabled()- Specified by:
isReportEnabled
in interfaceConfiguration
-
getUrl
Description copied from interface:Configuration
Retrieves the url used to construct the dataSource. May be null if the dataSource was passed in directly.- Specified by:
getUrl
in interfaceConfiguration
- Returns:
- The url used to construct the dataSource. May be null if the dataSource was passed in directly.
-
getWorkingDirectory
- Specified by:
getWorkingDirectory
in interfaceConfiguration
-
getUser
Description copied from interface:Configuration
Retrieves the user used to construct the dataSource. May be null if the dataSource was passed in directly, or if dataSource did not need a user.- Specified by:
getUser
in interfaceConfiguration
- Returns:
- The user used to construct the dataSource. May be null if the dataSource was passed in directly, or if dataSource did not need a user.
-
getPassword
Description copied from interface:Configuration
Retrieves the password used to construct the dataSource. May be null if the dataSource was passed in directly, or if dataSource did not need a password.- Specified by:
getPassword
in interfaceConfiguration
- Returns:
- The password used to construct the dataSource. May be null if the dataSource was passed in directly, or if dataSource did not need a password.
-
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. The interval between retries doubles with each subsequent attempt.- Specified by:
getConnectRetries
in interfaceConfiguration
- Returns:
- The maximum number of retries when attempting to connect to the database. (default: 0)
-
getConnectRetriesInterval
public int getConnectRetriesInterval()Description copied from interface:Configuration
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.- Specified by:
getConnectRetriesInterval
in interfaceConfiguration
- Returns:
- The maximum time between retries in seconds (default: 120)
-
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
)
-
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
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 >>)
-
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)
-
getCallbacks
Description copied from interface:Configuration
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)
-
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)
-
isExecuteInTransaction
public boolean isExecuteInTransaction()Description copied from interface:Configuration
Checks whether SQL is executed in a transaction.- Specified by:
isExecuteInTransaction
in interfaceConfiguration
- Returns:
- Whether SQL is executed in a transaction. (default: true)
-
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
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
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
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)
-
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)
-
getPlaceholderSuffix
Description copied from interface:Configuration
Retrieves the suffix of every placeholder.- Specified by:
getPlaceholderSuffix
in interfaceConfiguration
- Returns:
- The suffix of every placeholder. (default: } )
-
getPlaceholderPrefix
Description copied from interface:Configuration
Retrieves the prefix of every placeholder.- Specified by:
getPlaceholderPrefix
in interfaceConfiguration
- Returns:
- The prefix of every placeholder. (default: ${ )
-
getPlaceholderSeparator
Description copied from interface:Configuration
Retrieves the separator of default placeholders.- Specified by:
getPlaceholderSeparator
in interfaceConfiguration
- Returns:
- The separator of default placeholders. (default: : )
-
getScriptPlaceholderSuffix
Description copied from interface:Configuration
Retrieves the suffix of every script placeholder.- Specified by:
getScriptPlaceholderSuffix
in interfaceConfiguration
- Returns:
- The suffix of every script placeholder. (default: __ )
-
getScriptPlaceholderPrefix
Description copied from interface:Configuration
Retrieves the prefix of every script placeholder.- Specified by:
getScriptPlaceholderPrefix
in interfaceConfiguration
- Returns:
- The prefix of every script placeholder. (default: FP__ )
-
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.
-
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 versionnext
: The next version of the schema, as defined by the first pending migration- <version>? (end with a '?'): Instructs Flyway not to fail if the target version doesn't exist. In this case, Flyway will go up to but not beyond the specified target (default: fail if the target version doesn't exist) Flyway Teams only
- Specified by:
getTarget
in interfaceConfiguration
- Returns:
- The target version up to which Flyway should consider migrations. Defaults to
latest
-
isFailOnMissingTarget
public boolean isFailOnMissingTarget()Description copied from interface:Configuration
Whether to fail if no migration with the configured target version exists (default:true
)- Specified by:
isFailOnMissingTarget
in interfaceConfiguration
-
getCherryPick
Description copied from interface:Configuration
Gets the migrations that Flyway should consider when migrating or undoing. Leave empty to consider all available migrations. Migrations not in this list will be ignored. Flyway Teams only- Specified by:
getCherryPick
in interfaceConfiguration
- Returns:
- The migrations that Flyway should consider when migrating or undoing.
-
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, or in the schema specified to flyway.defaultSchema.- Specified by:
getTable
in interfaceConfiguration
- Returns:
- The name of the schema history table that will be used by Flyway. (default: flyway_schema_history)
-
getTablespace
Description copied from interface:Configuration
The tablespace where to create the schema history table that will be used by Flyway. If not specified, Flyway uses the default tablespace for the database connection. This setting is only relevant for databases that do support the notion of tablespace. Its 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.
-
getDefaultSchema
Description copied from interface:Configuration
The default schema managed by Flyway. This schema name is case-sensitive. If not specified, but schemas is, Flyway uses the first schema in that list. If that is also not specified, Flyway 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).
- Specified by:
getDefaultSchema
in interfaceConfiguration
- Returns:
- The default schema managed by Flyway, which is where the schema history table will reside. (default: The first schema specified in getSchemas(), and failing that the default schema for the database connection)
-
getSchemas
Description copied from interface:Configuration
The schemas managed by Flyway. These schema names are case-sensitive. If not specified, Flyway uses the default schema for the database connection. If defaultSchema is not specified, then the first of this list also acts as the default schema.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)
-
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)
-
isDetectEncoding
public boolean isDetectEncoding()Description copied from interface:Configuration
Whether Flyway should try to automatically detect SQL migration file encoding- Specified by:
isDetectEncoding
in interfaceConfiguration
- Returns:
true
to enable auto detection,false
otherwise Flyway Teams only
-
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 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.- Specified by:
getLocations
in interfaceConfiguration
- Returns:
- Locations to scan recursively for migrations. (default: classpath:db/migration)
-
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 thebaselineVersion
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
)
-
isSkipExecutingMigrations
public boolean isSkipExecutingMigrations()Description copied from interface:Configuration
Whether Flyway 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 withcherryPick
to skip specific migrations instead of all pending ones. Flyway Teams only- Specified by:
isSkipExecutingMigrations
in interfaceConfiguration
- Returns:
true
if executing the migrations should be skipped on migrate,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
)
-
getIgnoreMigrationPatterns
Description copied from interface:Configuration
Ignore migrations that match this comma-separated list of patterns when validating migrations. Each pattern is of the form: See https://documentation.red-gate.com/fd/ignore-migration-patterns-184127507.html for full details Example: repeatable:missing,versioned:pending,*:failed (default: *:future) Flyway Teams only - Specified by:
getIgnoreMigrationPatterns
in interfaceConfiguration
-
isValidateMigrationNaming
public boolean isValidateMigrationNaming()Description copied from interface:Configuration
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.- Specified by:
isValidateMigrationNaming
in interfaceConfiguration
- Returns:
false
to continue normally,true
to fail fast with an exception. (default:false
)
-
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 a career limiting move.- Specified by:
isCleanDisabled
in interfaceConfiguration
- Returns:
true
to disable clean.false
to be able to clean. (default:true
)
-
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
)
-
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
)
-
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
).
-
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:
Flyway Teams only*:123:W
- Specified by:
getErrorOverrides
in interfaceConfiguration
- Returns:
- The ErrorOverrides or an empty array if none are defined. (default: none)
-
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 Teams only- Specified by:
getDryRunOutput
in interfaceConfiguration
- Returns:
- The stream or
null
if the SQL statements are executed against the database directly.
-
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 Teams only- Specified by:
isStream
in interfaceConfiguration
- Returns:
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 Teams only- Specified by:
isBatch
in interfaceConfiguration
- Returns:
true
to batch SQL statements.false
to execute them individually instead. (default:false
)
-
getKerberosConfigFile
Description copied from interface:Configuration
The path to the Kerberos config file. Flyway Teams only- Specified by:
getKerberosConfigFile
in interfaceConfiguration
-
isOutputQueryResults
public boolean isOutputQueryResults()Description copied from interface:Configuration
Whether Flyway should output a table with the results of queries when executing migrations. Flyway Teams only- Specified by:
isOutputQueryResults
in interfaceConfiguration
- Returns:
true
to output the results table (default:true
)
-
getResourceProvider
Description copied from interface:Configuration
Retrieves the custom ResourceProvider to be used to look up resources. If not set, the default strategy will be used.- Specified by:
getResourceProvider
in interfaceConfiguration
- Returns:
- The custom ResourceProvider to be used to look up resources (default: null)
-
getJavaMigrationClassProvider
Description copied from interface:Configuration
Retrieves the custom ClassProvider to be used to look upJavaMigration
classes. If not set, the default strategy will be used.- Specified by:
getJavaMigrationClassProvider
in interfaceConfiguration
- Returns:
- The custom ClassProvider to be used to look up
JavaMigration
classes (default: null)
-
isCreateSchemas
public boolean isCreateSchemas()Description copied from interface:Configuration
Whether Flyway should attempt to create the schemas specified in the schemas property.- Specified by:
isCreateSchemas
in interfaceConfiguration
- Returns:
-
getLockRetryCount
public int getLockRetryCount()Description copied from interface:Configuration
The maximum number of retries when trying to obtain a lock. -1 indicates attempting to repeat indefinitely.- Specified by:
getLockRetryCount
in interfaceConfiguration
-
getJdbcProperties
Description copied from interface:Configuration
Properties to pass to the JDBC driver object Flyway Teams only- Specified by:
getJdbcProperties
in interfaceConfiguration
- Returns:
- Properties that will be passed to the JDBC driver object
-
isFailOnMissingLocations
public boolean isFailOnMissingLocations()Description copied from interface:Configuration
Whether to fail if a location specified in the flyway.locations option doesn't exist- Specified by:
isFailOnMissingLocations
in interfaceConfiguration
- Returns:
-
getLoggers
Description copied from interface:Configuration
The loggers Flyway should use. Valid options are:- auto: Auto detect the logger (default behavior)
- console: Use stdout/stderr (only available when using the CLI)
- slf4j: Use the slf4j logger
- log4j2: Use the log4j2 logger
- apache-commons: Use the Apache Commons logger
- Specified by:
getLoggers
in interfaceConfiguration
-
getDriver
Description copied from interface:Configuration
The JDBC driver of the configuration- Specified by:
getDriver
in interfaceConfiguration
-
getDatabaseType
public org.flywaydb.core.internal.database.DatabaseType getDatabaseType()Description copied from interface:Configuration
Get the Database type determined by the URL or Datasource- Specified by:
getDatabaseType
in interfaceConfiguration
-
getCachedResolvedEnvironments
public Map<String,org.flywaydb.core.internal.configuration.models.ResolvedEnvironment> getCachedResolvedEnvironments()Description copied from interface:Configuration
Gets the connection environments that have already been resolved from this configuration- Specified by:
getCachedResolvedEnvironments
in interfaceConfiguration
-
getCachedDataSources
public Map<String,org.flywaydb.core.internal.configuration.models.DataSourceModel> getCachedDataSources()Description copied from interface:Configuration
Gets DataSources for all the environments- Specified by:
getCachedDataSources
in interfaceConfiguration
-
getCurrentEnvironmentName
Description copied from interface:Configuration
Get the name of the current environment- Specified by:
getCurrentEnvironmentName
in interfaceConfiguration
-
createProgress
- Specified by:
createProgress
in interfaceConfiguration
-
getResolvedEnvironment
public org.flywaydb.core.internal.configuration.models.ResolvedEnvironment getResolvedEnvironment(String envName, org.flywaydb.core.internal.configuration.resolvers.ProvisionerMode provisionerMode, org.flywaydb.core.ProgressLogger progress) - Specified by:
getResolvedEnvironment
in interfaceConfiguration
-