com.googlecode.flyway.core.migration.java
Class BaseJavaMigration

java.lang.Object
  extended by com.googlecode.flyway.core.migration.Migration
      extended by com.googlecode.flyway.core.migration.BaseMigration
          extended by com.googlecode.flyway.core.migration.java.BaseJavaMigration
All Implemented Interfaces:
java.lang.Comparable<Migration>

public abstract class BaseJavaMigration
extends BaseMigration

Base class for java migration classes whose name conforms to the Flyway standard. Example: V1_2__Change_values


Field Summary
 
Fields inherited from class com.googlecode.flyway.core.migration.Migration
checksum, description, schemaVersion, script
 
Constructor Summary
protected BaseJavaMigration()
          Initializes this Migration with this standard Flyway name.
protected BaseJavaMigration(java.lang.String version, java.lang.String description)
          Initializes this Migration with this version
 
Method Summary
protected abstract  void doMigrateInTransaction(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          Performs the migration inside a transaction.
 MigrationType getMigrationType()
           
 void migrate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DbSupport dbSupport)
          Performs the migration.
 
Methods inherited from class com.googlecode.flyway.core.migration.BaseMigration
initVersion
 
Methods inherited from class com.googlecode.flyway.core.migration.Migration
compareTo, getChecksum, getDescription, getScript, getVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseJavaMigration

protected BaseJavaMigration()
Initializes this Migration with this standard Flyway name.


BaseJavaMigration

protected BaseJavaMigration(java.lang.String version,
                            java.lang.String description)
Initializes this Migration with this version

Parameters:
version - The version string for this migration, e.g. 1.2.3
description - The description for this migration
Method Detail

getMigrationType

public MigrationType getMigrationType()
Specified by:
getMigrationType in class Migration
Returns:
The type of migration (INIT, SQL or JAVA)

migrate

public final void migrate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                          DbSupport dbSupport)
                   throws java.lang.IllegalStateException
Performs the migration.

Specified by:
migrate in class Migration
Parameters:
jdbcTemplate - To execute the migration statements.
dbSupport - The support for database-specific extensions.
Throws:
java.lang.IllegalStateException - Thrown when the migration failed.

doMigrateInTransaction

protected abstract void doMigrateInTransaction(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
                                        throws java.lang.Exception
Performs the migration inside a transaction.

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


Copyright © 2010. All Rights Reserved.