com.google.code.flyway.core
Class BaseMigration

java.lang.Object
  extended by com.google.code.flyway.core.BaseMigration
All Implemented Interfaces:
Migration
Direct Known Subclasses:
BaseJavaMigration, SqlMigration

public abstract class BaseMigration
extends java.lang.Object
implements Migration

Base migration for migrations that use the standard Flyway version + description embedding in their name. These migrations have names like V1_2__Description .


Constructor Summary
BaseMigration()
           
 
Method Summary
protected abstract  void doMigrate(org.springframework.jdbc.core.simple.SimpleJdbcTemplate jdbcTemplate)
          Performs the migration.
 long getExecutionTime()
           
 MigrationState getState()
           
 SchemaVersion getVersion()
           
protected  void initVersion(java.lang.String migrationName)
          Initializes the version of this Migration based on this standard Flyway name.
 void migrate(org.springframework.jdbc.core.simple.SimpleJdbcTemplate jdbcTemplate)
          Performs the migration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.google.code.flyway.core.Migration
getScriptName
 

Constructor Detail

BaseMigration

public BaseMigration()
Method Detail

getVersion

public SchemaVersion getVersion()
Specified by:
getVersion in interface Migration
Returns:
The schema version after the migration is complete.

initVersion

protected final void initVersion(java.lang.String migrationName)
Initializes the version of this Migration based on this standard Flyway name.

Parameters:
migrationName - The migration name in standard Flyway format. Ex.: V1_2__Description .

getState

public MigrationState getState()
Specified by:
getState in interface Migration
Returns:
The state of this migration.

getExecutionTime

public long getExecutionTime()
Specified by:
getExecutionTime in interface Migration
Returns:
The time (in ms) it took to execute.

migrate

public final void migrate(org.springframework.jdbc.core.simple.SimpleJdbcTemplate jdbcTemplate)
Description copied from interface: Migration
Performs the migration. The migration state and the execution time are updated accordingly.

Specified by:
migrate in interface Migration
Parameters:
jdbcTemplate - To execute the migration statements.

doMigrate

protected abstract void doMigrate(org.springframework.jdbc.core.simple.SimpleJdbcTemplate jdbcTemplate)
                           throws java.lang.Exception
Performs the migration.

Parameters:
jdbcTemplate - To execute the migration statements.
Throws:
java.lang.Exception - Thrown when the migration failed.


Copyright © 2010. All Rights Reserved.