com.google.code.flyway.core
Class Migration

java.lang.Object
  extended by com.google.code.flyway.core.Migration
Direct Known Subclasses:
BaseMigration

public class Migration
extends java.lang.Object

A migration of a single version of the schema.

Author:
Axel Fontaine

Field Summary
protected  int executionTime
          The time (in ms) it took to execute.
protected  MigrationState migrationState
          The state of this migration.
protected  SchemaVersion schemaVersion
          The target schema version of this migration.
protected  java.lang.String scriptName
          The script name for the migration history.
 
Constructor Summary
Migration()
           
 
Method Summary
 void assertNotFailed()
          Asserts that this migration has not failed.
protected  void doMigrate(org.springframework.transaction.support.TransactionTemplate transactionTemplate, org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DbSupport dbSupport)
          Performs the migration.
 long getExecutionTime()
           
 java.lang.String getScriptName()
           
 MigrationState getState()
           
 SchemaVersion getVersion()
           
 void migrate(org.springframework.transaction.support.TransactionTemplate transactionTemplate, org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DbSupport dbSupport)
          Performs the migration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

schemaVersion

protected SchemaVersion schemaVersion
The target schema version of this migration.


migrationState

protected MigrationState migrationState
The state of this migration.


executionTime

protected int executionTime
The time (in ms) it took to execute.


scriptName

protected java.lang.String scriptName
The script name for the migration history.

Constructor Detail

Migration

public Migration()
Method Detail

getVersion

public SchemaVersion getVersion()
Returns:
The schema version after the migration is complete.

getState

public MigrationState getState()
Returns:
The state of this migration.

getExecutionTime

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

getScriptName

public java.lang.String getScriptName()
Returns:
The script name for the migration history.

assertNotFailed

public void assertNotFailed()
Asserts that this migration has not failed.

Throws:
java.lang.IllegalStateException - Thrown when this migration has failed.

migrate

public final void migrate(org.springframework.transaction.support.TransactionTemplate transactionTemplate,
                          org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                          DbSupport dbSupport)
Performs the migration. The migration state and the execution time are updated accordingly.

Parameters:
transactionTemplate - The transaction template to use.
jdbcTemplate - To execute the migration statements.
dbSupport - The support for database-specific extensions.

doMigrate

protected void doMigrate(org.springframework.transaction.support.TransactionTemplate transactionTemplate,
                         org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                         DbSupport dbSupport)
                  throws org.springframework.dao.DataAccessException
Performs the migration.

Parameters:
transactionTemplate - The transaction template to use.
jdbcTemplate - To execute the migration statements.
dbSupport - The support for database-specific extensions.
Throws:
org.springframework.dao.DataAccessException - Thrown when the migration failed.


Copyright © 2010. All Rights Reserved.