com.googlecode.flyway.core.dbsupport.h2
Class H2DbSupport

java.lang.Object
  extended by com.googlecode.flyway.core.dbsupport.h2.H2DbSupport
All Implemented Interfaces:
DbSupport

public class H2DbSupport
extends java.lang.Object
implements DbSupport

H2 database specific support


Constructor Summary
H2DbSupport()
           
 
Method Summary
 SqlScript createCleanScript(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          Creates a new sql script which clean the current schema, by dropping all objects.
 SqlScript createSqlScript(java.lang.String sqlScriptSource, PlaceholderReplacer placeholderReplacer)
          Creates a new sql script from this resource with these placeholders to replace.
 java.lang.String getCreateMetaDataTableScriptLocation()
           
 java.lang.String getCurrentSchema(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
          Retrieves the current schema.
 boolean metaDataTableExists(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate, java.lang.String schemaMetaDataTable)
          Checks whether Flyway's metadata table is already present in the database.
 boolean supportsDatabase(java.lang.String databaseProductName)
          Checks whether this DbSupport class supports the database with this product name.
 boolean supportsDdlTransactions()
          Checks whether ddl transactions are supported for this database.
 boolean supportsLocking()
          Checks whether locking using select ... for update is supported for this database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

H2DbSupport

public H2DbSupport()
Method Detail

getCreateMetaDataTableScriptLocation

public java.lang.String getCreateMetaDataTableScriptLocation()
Specified by:
getCreateMetaDataTableScriptLocation in interface DbSupport
Returns:
The location on the classpath where the create metadata table script resides.

getCurrentSchema

public java.lang.String getCurrentSchema(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Description copied from interface: DbSupport
Retrieves the current schema.

Specified by:
getCurrentSchema in interface DbSupport
Parameters:
jdbcTemplate - The jdbc template used for querying the database.
Returns:
The current schema for this connection.

supportsDatabase

public boolean supportsDatabase(java.lang.String databaseProductName)
Description copied from interface: DbSupport
Checks whether this DbSupport class supports the database with this product name.

Specified by:
supportsDatabase in interface DbSupport
Parameters:
databaseProductName - The name of the database.
Returns:
true if the database is supported, false if not.

metaDataTableExists

public boolean metaDataTableExists(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate,
                                   java.lang.String schemaMetaDataTable)
Description copied from interface: DbSupport
Checks whether Flyway's metadata table is already present in the database.

Specified by:
metaDataTableExists in interface DbSupport
Parameters:
jdbcTemplate - The jdbc template used for querying the database.
schemaMetaDataTable - The table to look for.
Returns:
true if the table exists, false if it doesn't.

supportsDdlTransactions

public boolean supportsDdlTransactions()
Description copied from interface: DbSupport
Checks whether ddl transactions are supported for this database.

Specified by:
supportsDdlTransactions in interface DbSupport
Returns:
true if ddl transactions are supported, false if not.

supportsLocking

public boolean supportsLocking()
Description copied from interface: DbSupport
Checks whether locking using select ... for update is supported for this database.

Specified by:
supportsLocking in interface DbSupport
Returns:
true if locking is supported, false if not.

createSqlScript

public SqlScript createSqlScript(java.lang.String sqlScriptSource,
                                 PlaceholderReplacer placeholderReplacer)
Description copied from interface: DbSupport
Creates a new sql script from this resource with these placeholders to replace.

Specified by:
createSqlScript in interface DbSupport
Parameters:
sqlScriptSource - The sql script as a text block with all placeholders still present.
placeholderReplacer - The placeholder replacer to apply to sql migration scripts.
Returns:
A new sql script, containing the statements from this resource, with all placeholders replaced.

createCleanScript

public SqlScript createCleanScript(org.springframework.jdbc.core.JdbcTemplate jdbcTemplate)
Description copied from interface: DbSupport
Creates a new sql script which clean the current schema, by dropping all objects.

Specified by:
createCleanScript in interface DbSupport
Parameters:
jdbcTemplate - The jdbc template used for querying the database.
Returns:
A new sql script, containing drop statements for all objects


Copyright © 2010. All Rights Reserved.