|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.googlecode.flyway.core.Flyway
public class Flyway
This is the centre point of Flyway, and for most users, the only class they will ever have to deal with.
It is THE public API from which all important Flyway functions such as clean, validate and migrate can be called.
| Constructor Summary | |
|---|---|
Flyway()
|
|
| Method Summary | |
|---|---|
void |
clean()
Drops all objects (tables, views, procedures, triggers, ...) in the current schema. |
void |
configure(java.util.Properties properties)
Configures Flyway with these properties. |
java.lang.String |
getBaseDir()
Retrieves the base directory on the classpath where the Sql migrations are located. |
java.lang.String |
getBasePackage()
Retrieves the base package where the Java migrations are located. |
java.lang.String |
getEncoding()
Retrieves the encoding of Sql migrations. |
java.lang.String |
getInitialDescription()
Retrieves the description of the initial version. |
SchemaVersion |
getInitialVersion()
Retrieves the initial version to put in the database. |
java.lang.String |
getPlaceholderPrefix()
Retrieves the prefix of every placeholder. |
java.util.Map<java.lang.String,java.lang.String> |
getPlaceholders()
Retrieves the map of |
java.lang.String |
getPlaceholderSuffix()
Retrieves the suffix of every placeholder. |
java.lang.String |
getSqlMigrationPrefix()
Retrieves the file name prefix for sql migrations. |
java.lang.String |
getSqlMigrationSuffix()
Retrieves the file name suffix for sql migrations. |
java.lang.String |
getTable()
Retrieves the name of the schema metadata table that will be used by flyway. |
SchemaVersion |
getTarget()
Retrieves the target version up to which Flyway should run migrations. |
ValidationErrorMode |
getValidationErrorMode()
Retrieves the error mode for validation. |
ValidationMode |
getValidationMode()
Retrieves the mode for validation. |
java.util.List<MetaDataTableRow> |
history()
Returns the history (all applied migrations) of the database. |
void |
init()
Creates and initializes the Flyway metadata table. |
void |
init(SchemaVersion version,
java.lang.String description)
Deprecated. Use init(), setInitialVersion() and setInitialDescription() instead. |
boolean |
isIgnoreFailedFutureMigration()
Retrieves whether to ignore failed future migrations when reading the metadata table. |
int |
migrate()
Starts the database migration. |
void |
setBaseDir(java.lang.String baseDir)
Sets the base directory on the classpath where the Sql migrations are located. |
void |
setBasePackage(java.lang.String basePackage)
Sets the base package where the migrations are located. |
void |
setDataSource(javax.sql.DataSource dataSource)
Sets the datasource to use. |
void |
setEncoding(java.lang.String encoding)
Sets the encoding of Sql migrations. |
void |
setIgnoreFailedFutureMigration(boolean ignoreFailedFutureMigration)
Ignores failed future migrations when reading the metadata table. |
void |
setInitialDescription(java.lang.String initialDescription)
The description of the initial version. |
void |
setInitialVersion(SchemaVersion initialVersion)
The initial version to put in the database. |
void |
setPlaceholderPrefix(java.lang.String placeholderPrefix)
Sets the prefix of every placeholder. |
void |
setPlaceholders(java.util.Map<java.lang.String,java.lang.String> placeholders)
Sets the placeholders to replace in sql migration scripts. |
void |
setPlaceholderSuffix(java.lang.String placeholderSuffix)
Sets the suffix of every placeholder. |
void |
setSqlMigrationPrefix(java.lang.String sqlMigrationPrefix)
Sets the file name prefix for sql migrations. |
void |
setSqlMigrationSuffix(java.lang.String sqlMigrationSuffix)
Sets the file name suffix for sql migrations. |
void |
setTable(java.lang.String table)
Sets the name of the schema metadata table that will be used by flyway. |
void |
setTarget(SchemaVersion target)
Sets the target version up to which Flyway should run migrations. |
void |
setValidationErrorMode(ValidationErrorMode validationErrorMode)
Sets the error mode for validation. |
void |
setValidationMode(ValidationMode validationMode)
Sets the ValidationMode for checksum validation. |
MetaDataTableRow |
status()
Returns the status (current version) of the database. |
void |
validate()
Validate applied migration with classpath migrations to detect accidental changes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Flyway()
| Method Detail |
|---|
public java.lang.String getBasePackage()
public java.lang.String getBaseDir()
public java.lang.String getEncoding()
public java.lang.String getTable()
public SchemaVersion getTarget()
public java.util.Map<java.lang.String,java.lang.String> getPlaceholders()
public java.lang.String getPlaceholderPrefix()
public java.lang.String getPlaceholderSuffix()
public java.lang.String getSqlMigrationPrefix()
public java.lang.String getSqlMigrationSuffix()
public boolean isIgnoreFailedFutureMigration()
true to terminate normally and log a warning, false to fail fast with an exception.
(default: false)public ValidationMode getValidationMode()
public ValidationErrorMode getValidationErrorMode()
public SchemaVersion getInitialVersion()
public java.lang.String getInitialDescription()
public void setIgnoreFailedFutureMigration(boolean ignoreFailedFutureMigration)
ignoreFailedFutureMigration - true to terminate normally and log a warning, false to fail
fast with an exception.public void setValidationMode(ValidationMode validationMode)
validationMode - The ValidationMode for checksum validationpublic void setValidationErrorMode(ValidationErrorMode validationErrorMode)
validationErrorMode - The error mode for validationpublic void setBasePackage(java.lang.String basePackage)
basePackage - The base package where the migrations are located. (default: db.migration)public void setBaseDir(java.lang.String baseDir)
baseDir - The base directory on the classpath where the Sql migrations are located. (default: sql/location)public void setEncoding(java.lang.String encoding)
encoding - The encoding of Sql migrations. (default: UTF-8)public void setTable(java.lang.String table)
table - The name of the schema metadata table that will be used by flyway. (default: schema_version)public void setTarget(SchemaVersion target)
target - The target version up to which Flyway should run migrations. Migrations with a higher version
number will not be applied. (default: the latest version)public void setPlaceholders(java.util.Map<java.lang.String,java.lang.String> placeholders)
placeholders - The map of public void setPlaceholderPrefix(java.lang.String placeholderPrefix)
placeholderPrefix - The prefix of every placeholder. (default: ${ )public void setPlaceholderSuffix(java.lang.String placeholderSuffix)
placeholderSuffix - The suffix of every placeholder. (default: } )public void setSqlMigrationPrefix(java.lang.String sqlMigrationPrefix)
sqlMigrationPrefix - The file name prefix for sql migrations (default: V)public void setSqlMigrationSuffix(java.lang.String sqlMigrationSuffix)
sqlMigrationSuffix - The file name suffix for sql migrations (default: .sql)public void setDataSource(javax.sql.DataSource dataSource)
dataSource - The datasource to use. Must have the necessary privileges to execute ddl.public void setInitialVersion(SchemaVersion initialVersion)
initialVersion - The initial version to put in the database. (default: 0)public void setInitialDescription(java.lang.String initialDescription)
initialDescription - The description of the initial version. (default: << Flyway Init >>)
public int migrate()
throws FlywayException
FlywayException - Thrown when the migration failed.
public void validate()
throws FlywayException
FlywayException - thrown when the validation failed.public void clean()
public MetaDataTableRow status()
null if no migration has been applied yet.public java.util.List<MetaDataTableRow> history()
public void init()
throws FlywayException
FlywayException - when the schema initialization failed.
@Deprecated
public void init(SchemaVersion version,
java.lang.String description)
throws FlywayException
version - (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.description - (Optional) The description of the initial version.
FlywayException - when the schema initialization failed.public void configure(java.util.Properties properties)
properties - Properties used for configuration.
FlywayException - when the configuration failed.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||