Class Flyway
- java.lang.Object
-
- org.flywaydb.core.Flyway
-
- All Implemented Interfaces:
Configuration
public class Flyway extends Object implements Configuration
This is the centre point of Flyway, and for most users, the only class they will ever have to deal with.It is THE public API from which all important Flyway functions such as clean, validate and migrate can be called.
To get started all you need to do is
Flyway flyway = Flyway.configure().dataSource(url, user, password).load(); flyway.migrate();
Deprecation warning: starting with Flyway 6.0 this class will no longer implement the Configuration interface.
-
-
Constructor Summary
Constructors Constructor Description Flyway()Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.Flyway(ClassLoader classLoader)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.Flyway(Configuration configuration)Creates a new instance of Flyway with this configuration.Flyway(FlywayConfiguration configuration)Deprecated.UseFlyway(Configuration)instead.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidbaseline()Baselines an existing database, excluding all migrations up to and including baselineVersion.voidclean()Drops all objects (tables, views, procedures, triggers, ...) in the configured schemas.static FluentConfigurationconfigure()This is your starting point.static FluentConfigurationconfigure(ClassLoader classLoader)This is your starting point.voidconfigure(Map<String,String> props)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidconfigure(Properties properties)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetBaselineDescription()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.MigrationVersiongetBaselineVersion()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.Callback[]getCallbacks()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.ClassLoadergetClassLoader()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.ConfigurationgetConfiguration()intgetConnectRetries()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.DataSourcegetDataSource()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.OutputStreamgetDryRunOutput()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.CharsetgetEncoding()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.ErrorHandler[]getErrorHandlers()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.String[]getErrorOverrides()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetInitSql()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetInstalledBy()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetLicenseKey()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.Location[]getLocations()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetPlaceholderPrefix()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.Map<String,String>getPlaceholders()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetPlaceholderSuffix()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetRepeatableSqlMigrationPrefix()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.MigrationResolver[]getResolvers()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.String[]getSchemas()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetSqlMigrationPrefix()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetSqlMigrationSeparator()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetSqlMigrationSuffix()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.String[]getSqlMigrationSuffixes()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetTable()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.MigrationVersiongetTarget()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.StringgetUndoSqlMigrationPrefix()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.MigrationInfoServiceinfo()Retrieves the complete information about all the migrations including applied, pending and current migrations with details and status.booleanisBaselineOnMigrate()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisBatch()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisCleanDisabled()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisCleanOnValidationError()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisGroup()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisIgnoreFutureMigrations()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisIgnoreIgnoredMigrations()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisIgnoreMissingMigrations()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisIgnorePendingMigrations()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisMixed()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisOracleSqlplus()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisOutOfOrder()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisPlaceholderReplacement()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisSkipDefaultCallbacks()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisSkipDefaultResolvers()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisStream()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.booleanisValidateOnMigrate()Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0.intmigrate()Starts the database migration.voidrepair()Repairs the Flyway schema history table.voidsetBaselineDescription(String baselineDescription)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetBaselineOnMigrate(boolean baselineOnMigrate)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetBaselineVersion(MigrationVersion baselineVersion)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetBaselineVersionAsString(String baselineVersion)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetBatch(boolean batch)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetCallbacks(Callback... callbacks)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetCallbacks(FlywayCallback... callbacks)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetCallbacksAsClassNames(String... callbacks)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetClassLoader(ClassLoader classLoader)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetCleanDisabled(boolean cleanDisabled)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetCleanOnValidationError(boolean cleanOnValidationError)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetDataSource(String url, String user, String password, String... initSqls)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetDataSource(DataSource dataSource)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetDryRunOutput(OutputStream dryRunOutput)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetDryRunOutputAsFile(File dryRunOutput)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetDryRunOutputAsFileName(String dryRunOutputFileName)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetEncoding(String encoding)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetErrorHandlers(ErrorHandler... errorHandlers)Deprecated.ErrorHandlers have been deprecated and will be removed in Flyway 6.0 use statement-level callbacks instead.voidsetErrorHandlersAsClassNames(String... errorHandlerClassNames)Deprecated.ErrorHandlers have been deprecated and will be removed in Flyway 6.0 use statement-level callbacks instead.voidsetErrorOverrides(String... errorOverrides)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetGroup(boolean group)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetIgnoreFutureMigrations(boolean ignoreFutureMigrations)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetIgnoreIgnoredMigrations(boolean ignoreIgnoredMigrations)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetIgnoreMissingMigrations(boolean ignoreMissingMigrations)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetInstalledBy(String installedBy)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetLicenseKey(String licenseKey)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetLocations(String... locations)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetMixed(boolean mixed)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetOracleSqlplus(boolean oracleSqlplus)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetOutOfOrder(boolean outOfOrder)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetPlaceholderPrefix(String placeholderPrefix)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetPlaceholderReplacement(boolean placeholderReplacement)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetPlaceholders(Map<String,String> placeholders)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetPlaceholderSuffix(String placeholderSuffix)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetRepeatableSqlMigrationPrefix(String repeatableSqlMigrationPrefix)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetResolvers(MigrationResolver... resolvers)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetResolversAsClassNames(String... resolvers)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetSchemas(String... schemas)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetSkipDefaultCallbacks(boolean skipDefaultCallbacks)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetSkipDefaultResolvers(boolean skipDefaultResolvers)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetSqlMigrationPrefix(String sqlMigrationPrefix)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetSqlMigrationSeparator(String sqlMigrationSeparator)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetSqlMigrationSuffix(String sqlMigrationSuffix)Deprecated.sqlMigrationSuffix has been deprecated and will be removed in Flyway 6.0.0.voidsetSqlMigrationSuffixes(String... sqlMigrationSuffixes)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetStream(boolean stream)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetTable(String table)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetTarget(MigrationVersion target)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetTargetAsString(String target)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetUndoSqlMigrationPrefix(String undoSqlMigrationPrefix)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.voidsetValidateOnMigrate(boolean validateOnMigrate)Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0.intundo()Undoes the most recently applied versioned migration.voidvalidate()Validate applied migrations against resolved ones (on the filesystem or classpath) to detect accidental changes that may prevent the schema(s) from being recreated exactly.
-
-
-
Constructor Detail
-
Flyway
@Deprecated public Flyway()
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Creates a new instance of Flyway. This is your starting point.
-
Flyway
@Deprecated public Flyway(ClassLoader classLoader)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Creates a new instance of Flyway. This is your starting point.- Parameters:
classLoader- The ClassLoader to use for loading migrations, resolvers, etc from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
Flyway
@Deprecated public Flyway(FlywayConfiguration configuration)
Deprecated.UseFlyway(Configuration)instead. Will be removed in Flyway 6.0.Creates a new instance of Flyway with this configuration.- Parameters:
configuration- The configuration to use.
-
Flyway
public Flyway(Configuration configuration)
Creates a new instance of Flyway with this configuration. In general the Flyway.configure() factory method should be preferred over this constructor, unless you need to create or reuse separate Configuration objects.- Parameters:
configuration- The configuration to use.
-
-
Method Detail
-
configure
public static FluentConfiguration configure()
This is your starting point. This creates a configuration which can be customized to your needs before being loaded into a new Flyway instance using the load() method.In its simplest form, this is how you configure Flyway with all defaults to get started:
Flyway flyway = Flyway.configure().dataSource(url, user, password).load();
After that you have a fully-configured Flyway instance at your disposal which can be used to invoke Flyway functionality such as migrate() or clean().
- Returns:
- A new configuration from which Flyway can be loaded.
-
configure
public static FluentConfiguration configure(ClassLoader classLoader)
This is your starting point. This creates a configuration which can be customized to your needs before being loaded into a new Flyway instance using the load() method.In its simplest form, this is how you configure Flyway with all defaults to get started:
Flyway flyway = Flyway.configure().dataSource(url, user, password).load();
After that you have a fully-configured Flyway instance at your disposal which can be used to invoke Flyway functionality such as migrate() or clean().
- Parameters:
classLoader- The class loader to use when loading classes and resources.- Returns:
- A new configuration from which Flyway can be loaded.
-
getConfiguration
public Configuration getConfiguration()
- Returns:
- The configuration that Flyway is using.
-
getLocations
@Deprecated public Location[] getLocations()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves 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:
getLocationsin interfaceConfiguration- Returns:
- Locations to scan recursively for migrations. (default: classpath:db/migration)
-
getEncoding
@Deprecated public Charset getEncoding()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the encoding of Sql migrations.- Specified by:
getEncodingin interfaceConfiguration- Returns:
- The encoding of Sql migrations. (default: UTF-8)
-
getSchemas
@Deprecated public String[] getSchemas()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the schemas managed by Flyway. These schema names are case-sensitive.Consequences:
- Flyway will automatically attempt to create all these schemas, unless the first one already exists.
- The first schema in the list will be automatically set as the default one during the migration.
- The first schema in the list will also be the one containing the schema history table.
- The schemas will be cleaned in the order of this list.
- If Flyway created them, the schemas themselves will as be dropped when cleaning.
- Specified by:
getSchemasin interfaceConfiguration- Returns:
- The schemas managed by Flyway. (default: The default schema for the database connection)
-
getTable
@Deprecated public String getTable()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the name of the schema 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:
getTablein interfaceConfiguration- Returns:
- The name of the schema schema history table that will be used by flyway. (default: flyway_schema_history)
-
getTarget
@Deprecated public MigrationVersion getTarget()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the target version up to which Flyway should consider migrations. Migrations with a higher version number will be ignored. The special valuecurrentdesignates the current version of the schema.- Specified by:
getTargetin interfaceConfiguration- Returns:
- The target version up to which Flyway should consider migrations. (default: the latest version)
-
isPlaceholderReplacement
@Deprecated public boolean isPlaceholderReplacement()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationChecks whether placeholders should be replaced.- Specified by:
isPlaceholderReplacementin interfaceConfiguration- Returns:
- Whether placeholders should be replaced. (default: true)
-
getPlaceholders
@Deprecated public Map<String,String> getPlaceholders()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the map of <placeholder, replacementValue> to apply to sql migration scripts.- Specified by:
getPlaceholdersin interfaceConfiguration- Returns:
- The map of <placeholder, replacementValue> to apply to sql migration scripts.
-
getPlaceholderPrefix
@Deprecated public String getPlaceholderPrefix()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the prefix of every placeholder.- Specified by:
getPlaceholderPrefixin interfaceConfiguration- Returns:
- The prefix of every placeholder. (default: ${ )
-
getPlaceholderSuffix
@Deprecated public String getPlaceholderSuffix()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the suffix of every placeholder.- Specified by:
getPlaceholderSuffixin interfaceConfiguration- Returns:
- The suffix of every placeholder. (default: } )
-
getSqlMigrationPrefix
@Deprecated public String getSqlMigrationPrefix()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe 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:
getSqlMigrationPrefixin interfaceConfiguration- Returns:
- The file name prefix for sql migrations. (default: V)
-
getRepeatableSqlMigrationPrefix
@Deprecated public String getRepeatableSqlMigrationPrefix()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves 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:
getRepeatableSqlMigrationPrefixin interfaceConfiguration- Returns:
- The file name prefix for repeatable sql migrations. (default: R)
-
getSqlMigrationSeparator
@Deprecated public String getSqlMigrationSeparator()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves 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:
getSqlMigrationSeparatorin interfaceConfiguration- Returns:
- The file name separator for sql migrations. (default: __)
-
getSqlMigrationSuffix
@Deprecated public String getSqlMigrationSuffix()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.
-
getSqlMigrationSuffixes
@Deprecated public String[] getSqlMigrationSuffixes()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe 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:
getSqlMigrationSuffixesin interfaceConfiguration- Returns:
- The file name suffixes for SQL migrations.
-
isIgnoreMissingMigrations
@Deprecated public boolean isIgnoreMissingMigrations()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationIgnore 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:
isIgnoreMissingMigrationsin interfaceConfiguration- Returns:
trueto continue normally and log a warning,falseto fail fast with an exception. (default:false)
-
isIgnoreIgnoredMigrations
@Deprecated public boolean isIgnoreIgnoredMigrations()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationIgnore 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:
isIgnoreIgnoredMigrationsin interfaceConfiguration- Returns:
trueto continue normally,falseto fail fast with an exception. (default:false)
-
isIgnorePendingMigrations
@Deprecated public boolean isIgnorePendingMigrations()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationIgnore 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:
isIgnorePendingMigrationsin interfaceConfiguration- Returns:
trueto continue normally,falseto fail fast with an exception. (default:false)
-
isIgnoreFutureMigrations
@Deprecated public boolean isIgnoreFutureMigrations()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationIgnore 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:
isIgnoreFutureMigrationsin interfaceConfiguration- Returns:
trueto continue normally and log a warning,falseto fail fast with an exception. (default:true)
-
isValidateOnMigrate
@Deprecated public boolean isValidateOnMigrate()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to automatically call validate or not when running migrate.- Specified by:
isValidateOnMigratein interfaceConfiguration- Returns:
trueif validate should be called.falseif not. (default:true)
-
isCleanOnValidationError
@Deprecated public boolean isCleanOnValidationError()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to automatically call clean or not when a validation error occurs.This is exclusively intended as a convenience for development. Even tough 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:
isCleanOnValidationErrorin interfaceConfiguration- Returns:
trueif clean should be called.falseif not. (default:false)
-
isCleanDisabled
@Deprecated public boolean isCleanDisabled()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to disable clean.This is especially useful for production environments where running clean can be quite a career limiting move.
- Specified by:
isCleanDisabledin interfaceConfiguration- Returns:
trueto disabled clean.falseto leave it enabled. (default:false)
-
getBaselineVersion
@Deprecated public MigrationVersion getBaselineVersion()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the version to tag an existing schema with when executing baseline.- Specified by:
getBaselineVersionin interfaceConfiguration- Returns:
- The version to tag an existing schema with when executing baseline. (default: 1)
-
getBaselineDescription
@Deprecated public String getBaselineDescription()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the description to tag an existing schema with when executing baseline.- Specified by:
getBaselineDescriptionin interfaceConfiguration- Returns:
- The description to tag an existing schema with when executing baseline. (default: << Flyway Baseline >>)
-
isBaselineOnMigrate
@Deprecated public boolean isBaselineOnMigrate()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to automatically call baseline when migrate is executed against a non-empty schema with no schema history table. This schema will then be initialized with the
baselineVersionbefore executing the migrations. Only migrations abovebaselineVersionwill then be applied.This is useful for initial 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:
isBaselineOnMigratein interfaceConfiguration- Returns:
trueif baseline should be called on migrate for non-empty schemas,falseif not. (default:false)
-
isOutOfOrder
@Deprecated public boolean isOutOfOrder()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationAllows 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:
isOutOfOrderin interfaceConfiguration- Returns:
trueif outOfOrder migrations should be applied,falseif not. (default:false)
-
getResolvers
@Deprecated public MigrationResolver[] getResolvers()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the The custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.- Specified by:
getResolversin interfaceConfiguration- Returns:
- The custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply. An empty array if none. (default: none)
-
isSkipDefaultResolvers
@Deprecated public boolean isSkipDefaultResolvers()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether Flyway should skip the default resolvers. If true, only custom resolvers are used.- Specified by:
isSkipDefaultResolversin interfaceConfiguration- Returns:
- Whether default built-in resolvers should be skipped. (default: false)
-
getDataSource
@Deprecated public DataSource getDataSource()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the dataSource to use to access the database. Must have the necessary privileges to execute ddl.- Specified by:
getDataSourcein interfaceConfiguration- Returns:
- The dataSource to use to access the database. Must have the necessary privileges to execute ddl.
-
getConnectRetries
@Deprecated public int getConnectRetries()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe 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:
getConnectRetriesin interfaceConfiguration- Returns:
- The maximum number of retries when attempting to connect to the database. (default: 0)
-
getInitSql
@Deprecated public String getInitSql()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe SQL statements to run to initialize a new database connection immediately after opening it.- Specified by:
getInitSqlin interfaceConfiguration- Returns:
- The SQL statements. (default:
null)
-
getClassLoader
@Deprecated public ClassLoader getClassLoader()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRetrieves the ClassLoader to use for loading migrations, resolvers, etc from the classpath.- Specified by:
getClassLoaderin interfaceConfiguration- Returns:
- The ClassLoader to use for loading migrations, resolvers, etc from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
isMixed
@Deprecated public boolean isMixed()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to allow mixing transactional and non-transactional statements within the same migration.- Specified by:
isMixedin interfaceConfiguration- Returns:
trueif mixed migrations should be allowed.falseif an error should be thrown instead. (default:false)
-
getInstalledBy
@Deprecated public String getInstalledBy()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe username that will be recorded in the schema history table as having applied the migration.- Specified by:
getInstalledByin interfaceConfiguration- Returns:
- The username or
nullfor the current database user of the connection. (default:null).
-
isGroup
@Deprecated public boolean isGroup()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to group all pending migrations together in the same transaction when applying them (only recommended for databases with support for DDL transactions).- Specified by:
isGroupin interfaceConfiguration- Returns:
trueif migrations should be grouped.falseif they should be applied individually instead. (default:false)
-
getErrorHandlers
@Deprecated public ErrorHandler[] getErrorHandlers()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationHandlers for errors and warnings that occur during a migration. This can be used to customize Flyway's behavior by for example throwing another runtime exception, outputting a warning or suppressing the error instead of throwing a FlywayException. ErrorHandlers are invoked in order until one reports to have successfully handled the errors or warnings. If none do, or if none are present, Flyway falls back to its default handling of errors and warnings.Flyway Pro and Flyway Enterprise only
- Specified by:
getErrorHandlersin interfaceConfiguration- Returns:
- The ErrorHandlers or an empty array if the default internal handler should be used instead. (default: none)
-
getErrorOverrides
@Deprecated public String[] getErrorOverrides()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationRules for the built-in error handler that lets you override specific SQL states and errors codes from error to warning or from warning to error.Each error override has the following format:
STATE:12345:W. It is a 5 character SQL state, a colon, the SQL error code, a colon and finally the desired behavior that should override the initial one. The following behaviors are accepted:Wto force a warning andEto force an error.For example, to force Oracle stored procedure compilation issues to produce errors instead of warnings, the following errorOverride can be used:
99999:17110:EFlyway Pro and Flyway Enterprise only
- Specified by:
getErrorOverridesin interfaceConfiguration- Returns:
- The ErrorOverrides or an empty array if none are defined. (default: none)
-
getDryRunOutput
@Deprecated public OutputStream getDryRunOutput()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe stream where to output the SQL statements of a migration dry run.nullif the SQL statements are executed against the database directly.Flyway Pro and Flyway Enterprise only
- Specified by:
getDryRunOutputin interfaceConfiguration- Returns:
- The stream or
nullif the SQL statements are executed against the database directly.
-
isStream
@Deprecated public boolean isStream()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether 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:
isStreamin interfaceConfiguration- Returns:
trueto stream SQL migrations.falseto fully loaded them in memory instead. (default:false)
-
isBatch
@Deprecated public boolean isBatch()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether 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:
isBatchin interfaceConfiguration- Returns:
trueto batch SQL statements.falseto execute them individually instead. (default:false)
-
isOracleSqlplus
@Deprecated public boolean isOracleSqlplus()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether to Flyway's support for Oracle SQL*Plus commands should be activated.Flyway Pro and Flyway Enterprise only
- Specified by:
isOracleSqlplusin interfaceConfiguration- Returns:
trueto active SQL*Plus support.falseto fail fast instead. (default:false)
-
getLicenseKey
@Deprecated public String getLicenseKey()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationFlyway's license key.Flyway Pro and Flyway Enterprise only
- Specified by:
getLicenseKeyin interfaceConfiguration- Returns:
- The license key.
-
setDryRunOutput
@Deprecated public void setDryRunOutput(OutputStream dryRunOutput)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the stream where to output the SQL statements of a migration dry run.nullto 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 ornullto execute the SQL statements directly against the database.
-
setDryRunOutputAsFile
@Deprecated public void setDryRunOutputAsFile(File dryRunOutput)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the file where to output the SQL statements of a migration dry run.nullto 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 ornullto execute the SQL statements directly against the database.
-
setDryRunOutputAsFileName
@Deprecated public void setDryRunOutputAsFileName(String dryRunOutputFileName)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the file where to output the SQL statements of a migration dry run.nullto 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 ornullto execute the SQL statements directly against the database.
-
setErrorHandlers
@Deprecated public void setErrorHandlers(ErrorHandler... errorHandlers)
Deprecated.ErrorHandlers have been deprecated and will be removed in Flyway 6.0 use statement-level callbacks instead.Handlers for errors and warnings that occur during a migration. This can be used to customize Flyway's behavior by for example throwing another runtime exception, outputting a warning or suppressing the error instead of throwing a FlywayException. ErrorHandlers are invoked in order until one reports to have successfully handled the errors or warnings. If none do, or if none are present, Flyway falls back to its default handling of errors and warnings.Flyway Pro and Flyway Enterprise only
- Parameters:
errorHandlers- The ErrorHandlers or an empty array if the default internal handler should be used instead. (default: none)
-
setErrorHandlersAsClassNames
@Deprecated public void setErrorHandlersAsClassNames(String... errorHandlerClassNames)
Deprecated.ErrorHandlers have been deprecated and will be removed in Flyway 6.0 use statement-level callbacks instead.Handlers for errors and warnings that occur during a migration. This can be used to customize Flyway's behavior by for example throwing another runtime exception, outputting a warning or suppressing the error instead of throwing a FlywayException. ErrorHandlers are invoked in order until one reports to have successfully handled the errors or warnings. If none do, or if none are present, Flyway falls back to its default handling of errors and warnings.Flyway Pro and Flyway Enterprise only
- Parameters:
errorHandlerClassNames- The fully qualified class names of ErrorHandlers or an empty array if the default internal handler should be used instead. (default: none)
-
setErrorOverrides
@Deprecated public void setErrorOverrides(String... errorOverrides)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Rules for the built-in error handler that lets you override specific SQL states and errors codes from error to warning or from warning to error.Each error override has the following format:
STATE:12345:W. It is a 5 character SQL state, a colon, the SQL error code, a colon and finally the desired behavior that should override the initial one. The following behaviors are accepted:Wto force a warning andEto force an error.For example, to force Oracle stored procedure compilation issues to produce errors instead of warnings, the following errorOverride can be used:
99999:17110:EFlyway Pro and Flyway Enterprise only
- Parameters:
errorOverrides- The ErrorOverrides or an empty array if none are defined. (default: none)
-
setGroup
@Deprecated public void setGroup(boolean group)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueif migrations should be grouped.falseif they should be applied individually instead. (default:false)
-
setInstalledBy
@Deprecated public void setInstalledBy(String installedBy)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.The username that will be recorded in the schema history table as having applied the migration.- Parameters:
installedBy- The username ornullfor the current database user of the connection. (default:null).
-
setMixed
@Deprecated public void setMixed(boolean mixed)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Whether to allow mixing transactional and non-transactional statements within the same migration.- Parameters:
mixed-trueif mixed migrations should be allowed.falseif an error should be thrown instead. (default:false)
-
setIgnoreMissingMigrations
@Deprecated public void setIgnoreMissingMigrations(boolean ignoreMissingMigrations)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueto continue normally and log a warning,falseto fail fast with an exception. (default:false)
-
setIgnoreIgnoredMigrations
@Deprecated public void setIgnoreIgnoredMigrations(boolean ignoreIgnoredMigrations)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueto continue normally,falseto fail fast with an exception. (default:false)
-
setIgnoreFutureMigrations
@Deprecated public void setIgnoreFutureMigrations(boolean ignoreFutureMigrations)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueto continue normally and log a warning,falseto fail fast with an exception. (default:true)
-
setValidateOnMigrate
@Deprecated public void setValidateOnMigrate(boolean validateOnMigrate)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Whether to automatically call validate or not when running migrate.- Parameters:
validateOnMigrate-trueif validate should be called.falseif not. (default:true)
-
setCleanOnValidationError
@Deprecated public void setCleanOnValidationError(boolean cleanOnValidationError)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Whether to automatically call clean or not when a validation error occurs.This is exclusively intended as a convenience for development. Even tough 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-trueif clean should be called.falseif not. (default:false)
-
setCleanDisabled
@Deprecated public void setCleanDisabled(boolean cleanDisabled)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Whether to disable clean.This is especially useful for production environments where running clean can be quite a career limiting move.
- Parameters:
cleanDisabled-trueto disabled clean.falseto leave it enabled. (default:false)
-
setLocations
@Deprecated public void setLocations(String... locations)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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 and may only contain sql migrations.- Parameters:
locations- Locations to scan recursively for migrations. (default: db/migration)
-
setEncoding
@Deprecated public void setEncoding(String encoding)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the encoding of Sql migrations.- Parameters:
encoding- The encoding of Sql migrations. (default: UTF-8)
-
setSchemas
@Deprecated public void setSchemas(String... schemas)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the schemas managed by Flyway. These schema names are case-sensitive. (default: The default schema for the database connection)Consequences:
- Flyway will automatically attempt to create all these schemas, unless the first one already exists.
- The first schema in the list will be automatically set as the default one during the migration.
- The first schema in the list will also be the one containing the schema history table.
- The schemas will be cleaned in the order of this list.
- If Flyway created them, the schemas themselves will as be dropped when cleaning.
- Parameters:
schemas- The schemas managed by Flyway. May not benull. Must contain at least one element.
-
setTable
@Deprecated public void setTable(String table)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the name of the schema 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 schema history table that will be used by flyway. (default: flyway_schema_history)
-
setTarget
@Deprecated public void setTarget(MigrationVersion target)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the target version up to which Flyway should consider migrations. Migrations with a higher version number will be ignored.- Parameters:
target- The target version up to which Flyway should consider migrations. (default: the latest version)
-
setTargetAsString
@Deprecated public void setTargetAsString(String target)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the target version up to which Flyway should consider migrations. Migrations with a higher version number will be ignored.- Parameters:
target- The target version up to which Flyway should consider migrations. The special valuecurrentdesignates the current version of the schema. (default: the latest version)
-
setPlaceholderReplacement
@Deprecated public void setPlaceholderReplacement(boolean placeholderReplacement)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets whether placeholders should be replaced.- Parameters:
placeholderReplacement- Whether placeholders should be replaced. (default: true)
-
setPlaceholders
@Deprecated public void setPlaceholders(Map<String,String> placeholders)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the placeholders to replace in sql migration scripts.- Parameters:
placeholders- The map of <placeholder, replacementValue> to apply to sql migration scripts.
-
setPlaceholderPrefix
@Deprecated public void setPlaceholderPrefix(String placeholderPrefix)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the prefix of every placeholder.- Parameters:
placeholderPrefix- The prefix of every placeholder. (default: ${ )
-
setPlaceholderSuffix
@Deprecated public void setPlaceholderSuffix(String placeholderSuffix)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Sets the suffix of every placeholder.- Parameters:
placeholderSuffix- The suffix of every placeholder. (default: } )
-
setSqlMigrationPrefix
@Deprecated public void setSqlMigrationPrefix(String sqlMigrationPrefix)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public String getUndoSqlMigrationPrefix()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationThe 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:
getUndoSqlMigrationPrefixin interfaceConfiguration- Returns:
- The file name prefix for undo sql migrations. (default: U)
-
setUndoSqlMigrationPrefix
@Deprecated public void setUndoSqlMigrationPrefix(String undoSqlMigrationPrefix)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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)
-
setRepeatableSqlMigrationPrefix
@Deprecated public void setRepeatableSqlMigrationPrefix(String repeatableSqlMigrationPrefix)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setSqlMigrationSeparator(String sqlMigrationSeparator)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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: __)
-
setSqlMigrationSuffix
@Deprecated public void setSqlMigrationSuffix(String sqlMigrationSuffix)
Deprecated.sqlMigrationSuffix has been deprecated and will be removed in Flyway 6.0.0. Use sqlMigrationSuffixes instead.Sets the file name suffix for sql migrations.Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql
- Parameters:
sqlMigrationSuffix- The file name suffix for sql migrations (default: .sql)
-
setSqlMigrationSuffixes
@Deprecated public void setSqlMigrationSuffixes(String... sqlMigrationSuffixes)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setDataSource(DataSource dataSource)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setDataSource(String url, String user, String password, String... initSqls)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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.initSqls- The (optional) sql statements to execute to initialize a connection immediately after obtaining it.
-
setClassLoader
@Deprecated public void setClassLoader(ClassLoader classLoader)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure(ClassLoader) instead.Sets the ClassLoader to use for resolving migrations on the classpath.- Parameters:
classLoader- The ClassLoader to use for loading migrations, resolvers, etc from the classpath. (default: Thread.currentThread().getContextClassLoader() )
-
setBaselineVersion
@Deprecated public void setBaselineVersion(MigrationVersion baselineVersion)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setBaselineVersionAsString(String baselineVersion)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setBaselineDescription(String baselineDescription)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setBaselineOnMigrate(boolean baselineOnMigrate)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
baselineVersionbefore executing the migrations. Only migrations abovebaselineVersionwill 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-trueif baseline should be called on migrate for non-empty schemas,falseif not. (default:false)
-
setOutOfOrder
@Deprecated public void setOutOfOrder(boolean outOfOrder)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueif outOfOrder migrations should be applied,falseif not. (default:false)
-
getCallbacks
@Deprecated public Callback[] getCallbacks()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationGets the callbacks for lifecycle notifications.- Specified by:
getCallbacksin interfaceConfiguration- Returns:
- The callbacks for lifecycle notifications. An empty array if none. (default: none)
-
isSkipDefaultCallbacks
@Deprecated public boolean isSkipDefaultCallbacks()
Deprecated.Direct configuration retrieval from the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.getConfiguration() instead.Description copied from interface:ConfigurationWhether Flyway should skip the default callbacks. If true, only custom callbacks are used.- Specified by:
isSkipDefaultCallbacksin interfaceConfiguration- Returns:
- Whether default built-in callbacks should be skipped. (default: false)
-
setCallbacks
@Deprecated public void setCallbacks(Callback... callbacks)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Set the callbacks for lifecycle notifications.- Parameters:
callbacks- The callbacks for lifecycle notifications. (default: none)
-
setCallbacks
@Deprecated public void setCallbacks(FlywayCallback... callbacks)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Set the callbacks for lifecycle notifications.- Parameters:
callbacks- The callbacks for lifecycle notifications. (default: none)
-
setCallbacksAsClassNames
@Deprecated public void setCallbacksAsClassNames(String... callbacks)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Set the callbacks for lifecycle notifications.- Parameters:
callbacks- The fully qualified class names of the callbacks for lifecycle notifications. (default: none)
-
setSkipDefaultCallbacks
@Deprecated public void setSkipDefaultCallbacks(boolean skipDefaultCallbacks)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setResolvers(MigrationResolver... resolvers)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setResolversAsClassNames(String... resolvers)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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
@Deprecated public void setSkipDefaultResolvers(boolean skipDefaultResolvers)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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)
-
setStream
@Deprecated public void setStream(boolean stream)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueto stream SQL migrations.falseto fully loaded them in memory instead. (default:false)
-
setBatch
@Deprecated public void setBatch(boolean batch)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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-trueto batch SQL statements.falseto execute them individually instead. (default:false)
-
setOracleSqlplus
@Deprecated public void setOracleSqlplus(boolean oracleSqlplus)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Whether to Flyway's support for Oracle SQL*Plus commands should be activated.Flyway Pro and Flyway Enterprise only
- Parameters:
oracleSqlplus-trueto active SQL*Plus support.falseto fail fast instead. (default:false)
-
setLicenseKey
@Deprecated public void setLicenseKey(String licenseKey)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Flyway's license key.Flyway Pro and Flyway Enterprise only
- Parameters:
licenseKey- The license key.
-
migrate
public int migrate() throws FlywayExceptionStarts the database migration. All pending migrations will be applied in order. Calling migrate on an up-to-date database has no effect.

- Returns:
- The number of successfully applied migrations.
- Throws:
FlywayException- when the migration failed.
-
undo
public int undo() throws FlywayExceptionUndoes the most recently applied versioned migration. If target is specified, Flyway will attempt to undo versioned migrations in the order they were applied until it hits one with a version below the target. If there is no versioned migration to undo, calling undo has no effect.
Flyway Pro and Flyway Enterprise only

- Returns:
- The number of successfully undone migrations.
- Throws:
FlywayException- when the undo failed.
-
validate
public void validate() throws FlywayExceptionValidate applied migrations against resolved ones (on the filesystem or classpath) to detect accidental changes that may prevent the schema(s) from being recreated exactly.
Validation fails if
- differences in migration names, types or checksums are found
- versions have been applied that aren't resolved locally anymore
- versions have been resolved that haven't been applied yet

- Throws:
FlywayException- when the validation failed.
-
clean
public void clean()
Drops all objects (tables, views, procedures, triggers, ...) in the configured schemas. The schemas are cleaned in the order specified by the
schemasproperty.
- Throws:
FlywayException- when the clean fails.
-
info
public MigrationInfoService info()
Retrieves the complete information about all the migrations including applied, pending and current migrations with details and status.

- Returns:
- All migrations sorted by version, oldest first.
- Throws:
FlywayException- when the info retrieval failed.
-
baseline
public void baseline() throws FlywayExceptionBaselines an existing database, excluding all migrations up to and including baselineVersion.

- Throws:
FlywayException- when the schema baselining failed.
-
repair
public void repair() throws FlywayExceptionRepairs the Flyway schema history table. This will perform the following actions:- Remove any failed migrations on databases without DDL transactions (User objects left behind must still be cleaned up manually)
- Realign the checksums, descriptions and types of the applied migrations with the ones of the available migrations

- Throws:
FlywayException- when the schema history table repair failed.
-
configure
@Deprecated public void configure(Properties properties)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.Configures Flyway with these properties. This overwrites any existing configuration. Property names are documented in the flyway maven plugin.To use a custom ClassLoader, the Flyway(ClassLoader) constructor must be called prior to calling this method.
- Parameters:
properties- Properties used for configuration.- Throws:
FlywayException- when the configuration failed.
-
configure
@Deprecated public void configure(Map<String,String> props)
Deprecated.Direct configuration of the Flyway object has been deprecated and will be removed in Flyway 6.0. Use Flyway.configure() instead.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.
-
-