com.googlecode.flyway.core.migration.init
Class InitMigration

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

public class InitMigration
extends Migration

Special type of migration used to mark the initial state of the database from which Flyway can migrate to subsequent versions. There can only be one init migration per database, and, if present, it must be the first one.


Field Summary
 
Fields inherited from class com.googlecode.flyway.core.migration.Migration
checksum, description, schemaVersion, script
 
Constructor Summary
InitMigration(SchemaVersion schemaVersion, java.lang.String description)
          Creates a new initial migration with this version.
 
Method Summary
 java.lang.Integer getChecksum()
           
 MigrationType getMigrationType()
           
 void migrate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DbSupport dbSupport)
          Performs the migration.
 
Methods inherited from class com.googlecode.flyway.core.migration.Migration
compareTo, equals, getDescription, getScript, getVersion, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InitMigration

public InitMigration(SchemaVersion schemaVersion,
                     java.lang.String description)
Creates a new initial migration with this version.

Only migrations with a version number higher than this one will be considered for this database.

Parameters:
schemaVersion - The initial version to put in the metadata table.
Method Detail

getMigrationType

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

getChecksum

public java.lang.Integer getChecksum()
Overrides:
getChecksum in class Migration
Returns:
The checksum of the migration.

migrate

public void migrate(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                    DbSupport dbSupport)
             throws org.springframework.dao.DataAccessException
Description copied from class: Migration
Performs the migration.

Specified by:
migrate in class 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 © 2011. All Rights Reserved.