com.googlecode.flyway.core.migration
Class Migration

java.lang.Object
  extended by com.googlecode.flyway.core.migration.Migration
All Implemented Interfaces:
java.lang.Comparable<Migration>
Direct Known Subclasses:
BaseMigration, InitMigration

public abstract class Migration
extends java.lang.Object
implements java.lang.Comparable<Migration>

A migration of a single version of the schema.

Author:
Axel Fontaine

Field Summary
protected  java.lang.Integer checksum
          The checksum of the migration.
protected  java.lang.String description
          The description for the migration history.
protected  SchemaVersion schemaVersion
          The target schema version of this migration.
protected  java.lang.String script
          The script name for the migration history.
 
Constructor Summary
Migration()
           
 
Method Summary
 int compareTo(Migration o)
           
 java.lang.Integer getChecksum()
           
 java.lang.String getDescription()
           
abstract  MigrationType getMigrationType()
           
 java.lang.String getScript()
           
 SchemaVersion getVersion()
           
abstract  void migrate(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.


description

protected java.lang.String description
The description for the migration history.


script

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


checksum

protected java.lang.Integer checksum
The checksum of the migration. Sql migrations use a crc-32 checksum of the sql script. Java migrations use the SUID or a custom checksum.

Constructor Detail

Migration

public Migration()
Method Detail

getMigrationType

public abstract MigrationType getMigrationType()
Returns:
The type of migration (INIT, SQL or JAVA)

getChecksum

public java.lang.Integer getChecksum()
Returns:
The checksum of the migration.

getVersion

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

getDescription

public java.lang.String getDescription()
Returns:
The description for the migration history.

getScript

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

compareTo

public int compareTo(Migration o)
Specified by:
compareTo in interface java.lang.Comparable<Migration>

migrate

public abstract void migrate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                             DbSupport dbSupport)
                      throws org.springframework.dao.DataAccessException
Performs the migration.

Parameters:
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.