com.googlecode.flyway.core.migration
Class DbMigrator

java.lang.Object
  extended by com.googlecode.flyway.core.migration.DbMigrator

public class DbMigrator
extends java.lang.Object

Main workflow for migrating the database.

Author:
Axel Fontaine

Constructor Summary
DbMigrator(org.springframework.transaction.support.TransactionTemplate transactionTemplate, org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DbSupport dbSupport, MetaDataTable metaDataTable, SchemaVersion target, boolean ignoreFailedFutureMigration)
          Creates a new database migrator.
 
Method Summary
 MetaDataTableRow applyMigration(Migration migration)
          Applies this migration to the database.
 int migrate(java.util.List<Migration> migrations)
          Starts the actual migration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbMigrator

public DbMigrator(org.springframework.transaction.support.TransactionTemplate transactionTemplate,
                  org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                  DbSupport dbSupport,
                  MetaDataTable metaDataTable,
                  SchemaVersion target,
                  boolean ignoreFailedFutureMigration)
Creates a new database migrator.

Parameters:
transactionTemplate - The transaction template to use.
jdbcTemplate - JdbcTemplate with ddl manipulation access to the database.
dbSupport - Database-specific functionality.
metaDataTable - The database metadata table.
target - The target version of the migration.
ignoreFailedFutureMigration - Flag whether to ignore failed future migrations or not.
Method Detail

migrate

public int migrate(java.util.List<Migration> migrations)
            throws FlywayException
Starts the actual migration.

Parameters:
migrations - The available migrations.
Returns:
The number of successfully applied migrations.
Throws:
FlywayException - when migration failed.

applyMigration

public final MetaDataTableRow applyMigration(Migration migration)
                                      throws MigrationException
Applies this migration to the database. The migration state and the execution time are updated accordingly.

Parameters:
migration - The migration to apply.
Returns:
The row that was added to the metadata table.
Throws:
MigrationException - when the migration failed.


Copyright © 2011. All Rights Reserved.