com.google.code.flyway.core
Class MetaDataTable

java.lang.Object
  extended by com.google.code.flyway.core.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
 void create()
          Creates Flyway's metadata table.
 boolean exists()
          Checks whether Flyway's metadata table is already present in the database.
 void init()
          Initializes Flyway's metadata table with an initial version.
 Migration latestAppliedMigration()
           
 void lock()
          Acquires an exclusive read-write lock on the metadata table.
 int migrationCount()
           
 void migrationFinished(Migration migration)
          Marks this migration as succeeded.
 
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

exists

public boolean exists()
               throws java.sql.SQLException
Checks whether Flyway's metadata table is already present in the database.

Returns:
true if the table exists, false if it doesn't.
Throws:
java.sql.SQLException - Thrown when the database metadata could not be read.

create

public void create()
Creates Flyway's metadata table.


init

public void init()
Initializes Flyway's metadata table with an initial version.


lock

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


migrationFinished

public void migrationFinished(Migration migration)
Marks this migration as succeeded.

Parameters:
migration - The migration that was run.

latestAppliedMigration

public Migration latestAppliedMigration()
Returns:
The latest migration applied on the schema.

migrationCount

public int migrationCount()
Returns:
Retrieves the number migrations applied to this database.


Copyright © 2010. All Rights Reserved.