com.googlecode.flyway.core.runtime
Class MetaDataTable

java.lang.Object
  extended by com.googlecode.flyway.core.runtime.MetaDataTable

public class MetaDataTable
extends java.lang.Object

Supports reading and writing to the metadata table.


Constructor Summary
MetaDataTable(org.springframework.transaction.support.TransactionTemplate transactionTemplate, org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, DbSupport dbSupport, java.lang.String tableName)
          Creates a new instance of the metadata table support.
 
Method Summary
 java.util.List<Migration> allAppliedMigrations()
           
 void createIfNotExists()
          Creates the metadata table if it doesn't already exist.
 void finishMigration(Migration migration)
          Persists the result of this migration.
 void init(SchemaVersion initialVersion)
          Creates and initializes the Flyway metadata table.
 Migration latestAppliedMigration()
           
 void lock()
          Acquires an exclusive read-write lock on the metadata table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaDataTable

public MetaDataTable(org.springframework.transaction.support.TransactionTemplate transactionTemplate,
                     org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                     DbSupport dbSupport,
                     java.lang.String tableName)
Creates a new instance of the metadata table support.

Parameters:
transactionTemplate - The transaction template to use.
jdbcTemplate - JdbcTemplate with ddl manipulation access to the database.
dbSupport - Database-specific functionality.
tableName - The name of the schema metadata table used by flyway.
Method Detail

createIfNotExists

public void createIfNotExists()
Creates the metadata table if it doesn't already exist.


init

public void init(SchemaVersion initialVersion)
Creates and initializes the Flyway metadata table.

Parameters:
initialVersion - (optional) The initial version to put in the metadata table. Only migrations with a version number higher than this one will be considered for this database. null defaults the initial version to 0.

lock

public void lock()
Acquires an exclusive read-write lock on the metadata table. This lock will be released automatically on commit.


finishMigration

public void finishMigration(Migration migration)
Persists the result of this migration.

Parameters:
migration - The migration that was run.

latestAppliedMigration

public Migration latestAppliedMigration()
Returns:
The latest migration applied on the schema. null if no migration has been applied so far.

allAppliedMigrations

public java.util.List<Migration> allAppliedMigrations()
Returns:
The list of all migrations applied on the schema (oldest first). An empty list if no migration has been applied so far.


Copyright © 2010. All Rights Reserved.