public abstract class AbstractFlywayTask
extends org.apache.tools.ant.Task
| Modifier and Type | Class and Description |
|---|---|
static class |
AbstractFlywayTask.CallbackElement
One <callback> sub-element within the <callbacks> element.
|
static class |
AbstractFlywayTask.CallbacksElement
The nested <callbacks> element of the task.
|
static class |
AbstractFlywayTask.LocationElement
One <location> sub-element within the <locations> element.
|
static class |
AbstractFlywayTask.LocationsElement
The nested <locations> element of the task.
|
static class |
AbstractFlywayTask.PlaceholderElement
Nested <placeholder> element inside the <placeholders> element of the migrate Ant task.
|
static class |
AbstractFlywayTask.PlaceholdersElement
Nested <placeholders> element of the migrate Ant task.
|
static class |
AbstractFlywayTask.ResolverElement
One <resolver> sub-element within the <resolvers> element.
|
static class |
AbstractFlywayTask.ResolversElement
The nested <resolvers> element of the task.
|
static class |
AbstractFlywayTask.SchemaElement
One <location> sub-element within the <locations> element.
|
static class |
AbstractFlywayTask.SchemasElement
The nested <schemas> element of the task.
|
| Modifier and Type | Field and Description |
|---|---|
protected org.flywaydb.core.internal.util.logging.Log |
log
Logger.
|
| Constructor and Description |
|---|
AbstractFlywayTask() |
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguredCallbacks(AbstractFlywayTask.CallbacksElement callbacksElement)
Do not use.
|
void |
addConfiguredLocations(AbstractFlywayTask.LocationsElement locationsElement)
Do not use.
|
void |
addConfiguredPlaceholders(AbstractFlywayTask.PlaceholdersElement placeholders)
Adds placeholders from a nested <placeholders> element.
|
void |
addConfiguredResolvers(AbstractFlywayTask.ResolversElement resolversElement)
Do not use.
|
void |
addConfiguredSchemas(AbstractFlywayTask.SchemasElement schemasElement)
Do not use.
|
protected abstract void |
doExecute(Flyway flyway)
Executes this task.
|
void |
execute() |
void |
setCallbacks(String callbacks) |
void |
setClasspath(org.apache.tools.ant.types.Path classpath) |
void |
setClasspathref(org.apache.tools.ant.types.Reference classpathref) |
void |
setCleanOnValidationError(boolean cleanOnValidationError) |
void |
setDriver(String driver) |
void |
setEncoding(String encoding) |
void |
setIgnoreFailedFutureMigration(boolean ignoreFailedFutureMigration) |
void |
setInitDescription(String initDescription) |
void |
setInitOnMigrate(boolean initOnMigrate)
Whether to automatically call init when migrate is executed against a non-empty schema with no metadata table.
|
void |
setInitVersion(String initVersion) |
void |
setOutOfOrder(boolean outOfOrder) |
void |
setPassword(String password) |
void |
setPlaceholderPrefix(String placeholderPrefix) |
void |
setPlaceholderSuffix(String placeholderSuffix) |
void |
setResolvers(String resolvers) |
void |
setSchemas(String schemas) |
void |
setSqlMigrationPrefix(String sqlMigrationPrefix)
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix ,
which using the defaults translates to V1_1__My_description.sql
|
void |
setSqlMigrationSeparator(String sqlMigrationSeparator)
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix ,
which using the defaults translates to V1_1__My_description.sql
|
void |
setSqlMigrationSuffix(String sqlMigrationSuffix)
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix ,
which using the defaults translates to V1_1__My_description.sql
|
void |
setTable(String table) |
void |
setTarget(String target) |
void |
setUrl(String url) |
void |
setUser(String user) |
void |
setValidateOnMigrate(boolean validateOnMigrate) |
protected boolean |
useValueIfPropertyNotSet(boolean value,
String flywayProperty)
Retrieves a boolean value either from an Ant property or if not set, directly.
|
protected String |
useValueIfPropertyNotSet(String value,
String flywayProperty)
Retrieves a value either from an Ant property or if not set, directly.
|
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskTypeprotected org.flywaydb.core.internal.util.logging.Log log
public void setClasspath(org.apache.tools.ant.types.Path classpath)
classpath - The classpath used to load the JDBC driver and the migrations.public void setClasspathref(org.apache.tools.ant.types.Reference classpathref)
classpathref - The reference to the classpath used to load the JDBC driver and the migrations.public void setDriver(String driver)
driver - The fully qualified classname of the jdbc driver to use to connect to the database.public void setUrl(String url)
url - The jdbc url to use to connect to the database.public void setUser(String user)
user - The user to use to connect to the database.public void setPassword(String password)
password - The password to use to connect to the database. (default: blank)public void setSchemas(String schemas)
schemas - Comma-separated list of the schemas managed by Flyway. These schema names are case-sensitive.Consequences:
public void setResolvers(String resolvers)
resolvers - The custom MigrationResolvers to be used in addition to the built-in ones for resolving Migrations to apply.
(default: none)
public void setCallbacks(String callbacks)
callbacks - A comma-separated list of fully qualified FlywayCallback implementation class names. These classes
will be instantiated and wired into the Flyway lifecycle notification events.public void setTable(String table)
table - The name of the schema metadata table that will be used by Flyway.
By default (single-schema mode) the metadata 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 metadata table is placed in the first schema of the list.
(default: schema_version)public void setInitVersion(String initVersion)
initVersion - The version to tag an existing schema with when executing init. (default: 1)public void setInitDescription(String initDescription)
initDescription - The description to tag an existing schema with when executing init. (default: << Flyway Init >>)protected String useValueIfPropertyNotSet(String value, String flywayProperty)
value - The value to check.flywayProperty - The flyway Ant property. Ex. 'url' for 'flyway.url'protected boolean useValueIfPropertyNotSet(boolean value,
String flywayProperty)
value - The boolean value to check.flywayProperty - The flyway Ant property. Ex. 'url' for 'flyway.url'public void addConfiguredLocations(AbstractFlywayTask.LocationsElement locationsElement)
locationsElement - The locations on the classpath.public void addConfiguredResolvers(AbstractFlywayTask.ResolversElement resolversElement)
resolversElement - The resolvers on the classpath.public void addConfiguredCallbacks(AbstractFlywayTask.CallbacksElement callbacksElement)
callbacksElement - The callbacks on the classpath.public void addConfiguredSchemas(AbstractFlywayTask.SchemasElement schemasElement)
schemasElement - The schemas.public void setEncoding(String encoding)
encoding - The encoding of Sql migrations. (default: UTF-8)public void setSqlMigrationPrefix(String sqlMigrationPrefix)
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql
sqlMigrationPrefix - The file name prefix for Sql migrations (default: V)public void setSqlMigrationSeparator(String sqlMigrationSeparator)
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql
sqlMigrationSeparator - The file name separator for Sql migrations (default: V)public void setSqlMigrationSuffix(String sqlMigrationSuffix)
Sql migrations have the following file name structure: prefixVERSIONseparatorDESCRIPTIONsuffix , which using the defaults translates to V1_1__My_description.sql
sqlMigrationSuffix - The file name suffix for Sql migrations (default: .sql)public void setTarget(String target)
target - The target version up to which Flyway should run migrations. Migrations with a higher version number will not be
applied. (default: the latest version)public void setCleanOnValidationError(boolean cleanOnValidationError)
cleanOnValidationError - Whether to automatically call clean or not when a validation error occurs. (default: false)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 !
public void setOutOfOrder(boolean outOfOrder)
outOfOrder - Allows migrations to be run "out of order" (default: false).
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.
Also configurable with Ant Property: ${flyway.outOfOrder}public void setPlaceholderPrefix(String placeholderPrefix)
placeholderPrefix - The prefix of every placeholder. (default: ${ )public void setPlaceholderSuffix(String placeholderSuffix)
placeholderSuffix - The suffix of every placeholder. (default: } )public void addConfiguredPlaceholders(AbstractFlywayTask.PlaceholdersElement placeholders)
placeholders - The fully configured placeholders element.public void setIgnoreFailedFutureMigration(boolean ignoreFailedFutureMigration)
ignoreFailedFutureMigration - Ignores failed future migrations when reading the metadata table. These are migrations that we 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 metadata table indicates that a migration to version 4.0
(unknown to us) has already been attempted and failed. Instead of bombing out (fail fast) with an exception, a
warning is logged and Flyway terminates normally. This is useful for situations where a database rollback is not
an option. An older version of the application can then be redeployed, even though a newer one failed due to a
bad migration. (default: false)public void setValidateOnMigrate(boolean validateOnMigrate)
validateOnMigrate - Whether to automatically call validate or not when running migrate. (default: true)public void setInitOnMigrate(boolean initOnMigrate)
Whether to automatically call init when migrate is executed against a non-empty schema with no metadata table.
This schema will then be initialized with the initialVersion before executing the migrations.
Only migrations above initialVersion 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!
Also configurable with Ant Property: ${flyway.initOnMigrate}initOnMigrate - true if init should be called on migrate for non-empty schemas, false if not. (default: false)public void execute()
throws org.apache.tools.ant.BuildException
execute in class org.apache.tools.ant.Taskorg.apache.tools.ant.BuildExceptionCopyright © 2014. All rights reserved.