com.googlecode.flyway.ant
Class MigrateTask

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by org.apache.tools.ant.Task
          extended by com.googlecode.flyway.ant.AbstractFlywayTask
              extended by com.googlecode.flyway.ant.AbstractMigrationLoadingTask
                  extended by com.googlecode.flyway.ant.MigrateTask
All Implemented Interfaces:
java.lang.Cloneable

public class MigrateTask
extends AbstractMigrationLoadingTask

Ant task that triggers the migration of the configured database to the latest version.


Nested Class Summary
static class MigrateTask.PlaceholderElement
          Nested <placeholder> element inside the <placeholders> element of the migrate Ant task.
static class MigrateTask.PlaceholdersElement
          Nested <placeholders> element of the migrate Ant task.
 
Nested classes/interfaces inherited from class com.googlecode.flyway.ant.AbstractMigrationLoadingTask
AbstractMigrationLoadingTask.LocationElement, AbstractMigrationLoadingTask.Locations
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.Task
taskName, taskType, wrapper
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
MigrateTask()
           
 
Method Summary
 void addConfiguredPlaceholder(MigrateTask.PlaceholderElement placeholder)
          Deprecated. Use the <placeholders> element instead of adding individual <placeholder> elements directly. Will be removed in Flyway 2.0.
 void addConfiguredPlaceholders(MigrateTask.PlaceholdersElement placeholders)
          Adds placeholders from a nested <placeholders> element.
protected  void doExecute(Flyway flyway)
          Executes this task.
 void setDisableInitCheck(boolean disableInitCheck)
           
 void setIgnoreFailedFutureMigration(boolean ignoreFailedFutureMigration)
           
 void setPlaceholderPrefix(java.lang.String placeholderPrefix)
           
 void setPlaceholderSuffix(java.lang.String placeholderSuffix)
           
 void setTarget(java.lang.String target)
           
 void setValidationMode(java.lang.String validationMode)
           
 
Methods inherited from class com.googlecode.flyway.ant.AbstractMigrationLoadingTask
addConfiguredLocations, setBaseDir, setBasePackage, setEncoding, setSqlMigrationPrefix, setSqlMigrationSuffix, setValidationErrorMode
 
Methods inherited from class com.googlecode.flyway.ant.AbstractFlywayTask
execute, setClasspath, setClasspathref, setDriver, setPassword, setSchemas, setTable, setUrl, setUser, useValueIfPropertyNotSet
 
Methods inherited from class org.apache.tools.ant.Task
bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MigrateTask

public MigrateTask()
Method Detail

setTarget

public void setTarget(java.lang.String target)
Parameters:
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)
Also configurable with Ant Property: ${flyway.target}

setIgnoreFailedFutureMigration

public void setIgnoreFailedFutureMigration(boolean ignoreFailedFutureMigration)
Parameters:
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)
Also configurable with Ant Property: ${flyway.ignoreFailedFutureMigration}

setPlaceholderPrefix

public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
Parameters:
placeholderPrefix - The prefix of every placeholder. (default: ${ )
Also configurable with Ant Property: ${flyway.placeholderPrefix}

setPlaceholderSuffix

public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
Parameters:
placeholderSuffix - The suffix of every placeholder. (default: } )
Also configurable with Ant Property: ${flyway.placeholderSuffix}

setValidationMode

public void setValidationMode(java.lang.String validationMode)
Parameters:
validationMode - The type of validation to be performed before migrating.

Possible values are:

NONE (default)
No validation is performed.

ALL
For each sql migration a CRC32 checksum is calculated when the sql script is executed. The validate mechanism checks if the sql migrations in the classpath still has the same checksum as the sql migration already executed in the database.

Also configurable with Ant Property: ${flyway.validationMode}

setDisableInitCheck

public void setDisableInitCheck(boolean disableInitCheck)
Parameters:
disableInitCheck - Flag to disable the check that a non-empty schema has been properly initialized with init. This check ensures Flyway does not migrate or clean the wrong database in case of a configuration mistake. Be careful when disabling this! (default: false)
Also configurable with Ant Property: ${flyway.disableInitCheck}

addConfiguredPlaceholder

@Deprecated
public void addConfiguredPlaceholder(MigrateTask.PlaceholderElement placeholder)
Deprecated. Use the <placeholders> element instead of adding individual <placeholder> elements directly. Will be removed in Flyway 2.0.

Adds a placeholder from a nested <placeholder> element. Called by Ant.

Parameters:
placeholder - The fully configured placeholder element.

addConfiguredPlaceholders

public void addConfiguredPlaceholders(MigrateTask.PlaceholdersElement placeholders)
Adds placeholders from a nested <placeholders> element. Called by Ant.

Parameters:
placeholders - The fully configured placeholders element.

doExecute

protected void doExecute(Flyway flyway)
                  throws java.lang.Exception
Description copied from class: AbstractFlywayTask
Executes this task.

Overrides:
doExecute in class AbstractMigrationLoadingTask
Parameters:
flyway - The flyway instance to operate on.
Throws:
java.lang.Exception - any exception


Copyright © 2012. All Rights Reserved.