|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectliquibase.migrator.Migrator
public class Migrator
Core class of the LiquiBase migrator. Although there are several ways of executing LiquiBase (Ant, command line, etc.) they are all wrappers around this class.
Using Migrator directly
| Nested Class Summary | |
|---|---|
static class |
Migrator.Mode
|
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_LOG_NAME
|
static java.lang.String |
SHOULD_RUN_SYSTEM_PROPERTY
|
| Constructor Summary | |
|---|---|
|
Migrator(java.lang.String changeLogFile,
FileOpener fileOpener)
|
protected |
Migrator(java.lang.String changeLogFile,
FileOpener fileOpener,
boolean alreadyHasChangeLogLock)
|
| Method Summary | |
|---|---|
boolean |
acquireLock()
|
void |
changelogSyncSQL(java.io.Writer outputWriter)
|
void |
checkDatabaseChangeLogTable()
|
void |
clearCheckSums()
Sets checksums to null so they will be repopulated next run |
boolean |
contextMatches(ChangeSet changeSet)
|
void |
dropAll()
Drops all database objects owned by the current user. |
void |
dropAll(java.lang.String... schemas)
Drops all database objects owned by the current user. |
void |
forceReleaseLock()
Releases whatever locks are on the database change log table |
void |
futureRollbackSQL(java.io.Writer output)
|
void |
generateDocumentation(java.lang.String outputDirectory)
|
java.lang.String |
getBuildVersion()
|
ChangeFactory |
getChangeFactory()
Returns the ChangeFactory for converting tag strings to Change implementations. |
java.util.Set<java.lang.String> |
getContexts()
|
Database |
getDatabase()
|
FileOpener |
getFileOpener()
FileOpener to use for accessing changelog files. |
Migrator.Mode |
getMode()
Sets the mode of opereration for the Migrator. |
java.io.Writer |
getOutputSQLWriter()
The Writer to append SQL if not executing directly against the database. |
PreconditionFactory |
getPreconditionFactory()
|
java.util.List<RanChangeSet> |
getRanChangeSetList()
Returns the ChangeSets that have been run against the current database. |
java.util.Date |
getRanDate(ChangeSet changeSet)
|
java.lang.Integer |
getRollbackCount()
Number of statements to rollback to if executing in rollback mode. |
java.util.Date |
getRollbackToDate()
Date to rollback to if executing in rollback mode. |
java.lang.String |
getRollbackToTag()
Tag to rollback to if executing in rollback mode. |
ChangeSet.RunStatus |
getRunStatus(ChangeSet changeSet)
Returns the run status for the given ChangeSet |
static java.lang.String |
getSchemaVersion()
|
protected ValidateChangeLogHandler |
getValidatChangeLogHandler()
|
void |
init(java.sql.Connection connection)
Initializes the Migrator with the given connection. |
void |
init(Database database)
Initializes the Migrator with the given database. |
void |
init(DatabaseConnection connection)
Initializes the Migrator with the given connection. |
boolean |
isSafeToRunMigration()
Returns true if it is "save" to migrate the database. |
DatabaseChangeLogLock[] |
listLocks()
Display change log lock information. |
java.util.List<ChangeSet> |
listUnrunChangeSets()
|
void |
markChangeSetAsRan(ChangeSet changeSet)
After the change set has been ran against the database this method will update the change log table with the information. |
void |
markChangeSetAsReRan(ChangeSet changeSet)
|
void |
migrate()
The primary method to call on Migrator to actually do work. |
void |
migrateSQL(java.io.Writer outputWriter)
|
void |
releaseLock()
|
void |
removeRanStatus(ChangeSet changeSet)
|
void |
reportLocks(java.io.PrintStream out)
|
void |
reportStatus(boolean verbose,
java.io.PrintStream out)
|
void |
rollback(java.lang.String tag)
|
void |
rollbackCount(int changesToRollback)
|
void |
rollbackCountSQL(int changesToRollback,
java.io.Writer output)
|
void |
rollbackSQL(java.lang.String tagToRollBackTo,
java.io.Writer output)
|
void |
rollbackToDate(java.util.Date date)
|
void |
rollbackToDateSQL(java.util.Date date,
java.io.Writer output)
|
void |
setContexts(java.lang.String contexts)
Set the contexts to execute. |
void |
setCurrentDateTimeFunction(java.lang.String currentDateTimeFunction)
Use this function to override the current date/time function used to insert dates into the database. |
void |
setMode(Migrator.Mode mode)
|
void |
setOutputSQLWriter(java.io.Writer outputSQLWriter)
|
void |
setRollbackCount(java.lang.Integer rollbackCount)
|
void |
setRollbackToDate(java.util.Date rollbackToDate)
|
void |
setRollbackToTag(java.lang.String rollbackToTag)
|
boolean |
swingPromptForNonLocalDatabase()
Displays swing-based dialog about running against a non-localhost database. |
void |
tag(java.lang.String tagString)
'Tags' the database for future rollback |
void |
validate()
Checks changelogs for bad MD5Sums and preconditions before attempting a migration |
protected boolean |
wasValidationRan()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SHOULD_RUN_SYSTEM_PROPERTY
public static final java.lang.String DEFAULT_LOG_NAME
| Constructor Detail |
|---|
public Migrator(java.lang.String changeLogFile,
FileOpener fileOpener)
protected Migrator(java.lang.String changeLogFile,
FileOpener fileOpener,
boolean alreadyHasChangeLogLock)
| Method Detail |
|---|
public void init(java.sql.Connection connection)
throws JDBCException
JDBCException
public void init(DatabaseConnection connection)
throws JDBCException
JDBCException
public void init(Database database)
throws JDBCException
JDBCExceptionpublic ChangeFactory getChangeFactory()
public PreconditionFactory getPreconditionFactory()
public java.lang.String getBuildVersion()
public static java.lang.String getSchemaVersion()
public Database getDatabase()
public Migrator.Mode getMode()
public void setMode(Migrator.Mode mode)
public java.io.Writer getOutputSQLWriter()
public void setOutputSQLWriter(java.io.Writer outputSQLWriter)
public java.util.Date getRollbackToDate()
public void setRollbackToDate(java.util.Date rollbackToDate)
public java.lang.String getRollbackToTag()
public void setRollbackToTag(java.lang.String rollbackToTag)
public java.lang.Integer getRollbackCount()
public void setRollbackCount(java.lang.Integer rollbackCount)
public FileOpener getFileOpener()
public void setCurrentDateTimeFunction(java.lang.String currentDateTimeFunction)
public java.util.List<RanChangeSet> getRanChangeSetList()
throws JDBCException
JDBCException
public void validate()
throws MigrationFailedException,
java.io.IOException,
JDBCException,
LockException
MigrationFailedException
java.io.IOException
JDBCException
LockException
public final void migrate()
throws LiquibaseException
LiquibaseException
public void changelogSyncSQL(java.io.Writer outputWriter)
throws LiquibaseException
LiquibaseException
public void migrateSQL(java.io.Writer outputWriter)
throws LiquibaseException
LiquibaseException
public void rollback(java.lang.String tag)
throws LiquibaseException
LiquibaseException
public void rollbackToDate(java.util.Date date)
throws LiquibaseException
LiquibaseException
public void rollbackCount(int changesToRollback)
throws LiquibaseException
LiquibaseException
public void rollbackSQL(java.lang.String tagToRollBackTo,
java.io.Writer output)
throws LiquibaseException
LiquibaseException
public void rollbackToDateSQL(java.util.Date date,
java.io.Writer output)
throws LiquibaseException
LiquibaseException
public void rollbackCountSQL(int changesToRollback,
java.io.Writer output)
throws LiquibaseException
LiquibaseException
public void futureRollbackSQL(java.io.Writer output)
throws LiquibaseException
LiquibaseExceptionprotected ValidateChangeLogHandler getValidatChangeLogHandler()
protected boolean wasValidationRan()
public final void dropAll()
throws JDBCException,
LockException
JDBCException
LockException
public final void dropAll(java.lang.String... schemas)
throws JDBCException,
LockException
JDBCException
LockException
public boolean acquireLock()
throws LockException
LockException
public void releaseLock()
throws LockException
LockException
public void forceReleaseLock()
throws LockException,
JDBCException,
java.io.IOException
LockException
JDBCException
java.io.IOException
public void tag(java.lang.String tagString)
throws JDBCException
JDBCException
public void checkDatabaseChangeLogTable()
throws JDBCException,
java.io.IOException
JDBCException
java.io.IOException
public boolean isSafeToRunMigration()
throws JDBCException
JDBCException
public DatabaseChangeLogLock[] listLocks()
throws JDBCException,
java.io.IOException,
LockException
JDBCException
java.io.IOException
LockException
public void reportLocks(java.io.PrintStream out)
throws LockException,
java.io.IOException,
JDBCException
LockException
java.io.IOException
JDBCExceptionpublic void setContexts(java.lang.String contexts)
public java.util.Set<java.lang.String> getContexts()
public ChangeSet.RunStatus getRunStatus(ChangeSet changeSet)
throws JDBCException,
DatabaseHistoryException
JDBCException
DatabaseHistoryException
public java.util.Date getRanDate(ChangeSet changeSet)
throws JDBCException,
DatabaseHistoryException
JDBCException
DatabaseHistoryException
public boolean swingPromptForNonLocalDatabase()
throws JDBCException
JDBCExceptionpublic boolean contextMatches(ChangeSet changeSet)
public java.util.List<ChangeSet> listUnrunChangeSets()
throws LiquibaseException
LiquibaseException
public void reportStatus(boolean verbose,
java.io.PrintStream out)
throws LiquibaseException
LiquibaseException
public void markChangeSetAsRan(ChangeSet changeSet)
throws JDBCException,
java.io.IOException
JDBCException
java.io.IOException
public void markChangeSetAsReRan(ChangeSet changeSet)
throws JDBCException,
java.io.IOException
JDBCException
java.io.IOException
public void removeRanStatus(ChangeSet changeSet)
throws JDBCException,
java.io.IOException
JDBCException
java.io.IOException
public void clearCheckSums()
throws JDBCException
JDBCException
public void generateDocumentation(java.lang.String outputDirectory)
throws LockException,
java.io.IOException,
JDBCException,
MigrationFailedException,
DatabaseHistoryException
LockException
java.io.IOException
JDBCException
MigrationFailedException
DatabaseHistoryException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||