liquibase
Class Liquibase

java.lang.Object
  extended by liquibase.Liquibase

public class Liquibase
extends java.lang.Object

Core Liquibase facade. Although there are several ways of executing Liquibase (Ant, command line, etc.) they are all wrappers around this class.


Field Summary
protected  Database database
           
static java.lang.String SHOULD_RUN_SYSTEM_PROPERTY
           
 
Constructor Summary
Liquibase(java.lang.String changeLogFile, ResourceAccessor resourceAccessor, Database database)
           
Liquibase(java.lang.String changeLogFile, ResourceAccessor resourceAccessor, DatabaseConnection conn)
           
 
Method Summary
 void changeLogSync(java.lang.String contexts)
           
 void changeLogSync(java.lang.String contexts, java.io.Writer output)
           
 void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, java.lang.String contexts)
           
 void clearCheckSums()
          Sets checksums to null so they will be repopulated next run
 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 forceReleaseLocks()
           
 void futureRollbackSQL(java.lang.String contexts, java.io.Writer output)
           
 void generateDocumentation(java.lang.String outputDirectory)
           
 void generateDocumentation(java.lang.String outputDirectory, java.lang.String contexts)
           
 ChangeLogParameters getChangeLogParameters()
           
 Database getDatabase()
           
 ResourceAccessor getFileOpener()
          FileOpener to use for accessing changelog files.
 boolean isSafeToRunMigration()
          Returns true if it is "save" to migrate the database.
 DatabaseChangeLogLock[] listLocks()
          Display change log lock information.
 java.util.List<ChangeSet> listUnrunChangeSets(java.lang.String contexts)
           
 void markNextChangeSetRan(java.lang.String contexts)
           
 void markNextChangeSetRan(java.lang.String contexts, java.io.Writer output)
           
 void reportLocks(java.io.PrintStream out)
           
 void reportStatus(boolean verbose, java.lang.String contexts, java.io.Writer out)
           
 void rollback(java.util.Date dateToRollBackTo, java.lang.String contexts)
           
 void rollback(java.util.Date dateToRollBackTo, java.lang.String contexts, java.io.Writer output)
           
 void rollback(int changesToRollback, java.lang.String contexts)
           
 void rollback(int changesToRollback, java.lang.String contexts, java.io.Writer output)
           
 void rollback(java.lang.String tagToRollBackTo, java.lang.String contexts)
           
 void rollback(java.lang.String tagToRollBackTo, java.lang.String contexts, java.io.Writer output)
           
 void setChangeLogParameter(java.lang.String key, java.lang.Object value)
           
 void setCurrentDateTimeFunction(java.lang.String currentDateTimeFunction)
          Use this function to override the current date/time function used to insert dates into the database.
 void tag(java.lang.String tagString)
          'Tags' the database for future rollback
 void update(int changesToApply, java.lang.String contexts)
           
 void update(int changesToApply, java.lang.String contexts, java.io.Writer output)
           
 void update(java.lang.String contexts)
           
 void update(java.lang.String contexts, java.io.Writer output)
           
 void updateTestingRollback(java.lang.String contexts)
           
 void validate()
          Checks changelogs for bad MD5Sums and preconditions before attempting a migration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHOULD_RUN_SYSTEM_PROPERTY

public static final java.lang.String SHOULD_RUN_SYSTEM_PROPERTY
See Also:
Constant Field Values

database

protected Database database
Constructor Detail

Liquibase

public Liquibase(java.lang.String changeLogFile,
                 ResourceAccessor resourceAccessor,
                 DatabaseConnection conn)
          throws LiquibaseException
Throws:
LiquibaseException

Liquibase

public Liquibase(java.lang.String changeLogFile,
                 ResourceAccessor resourceAccessor,
                 Database database)
          throws LiquibaseException
Throws:
LiquibaseException
Method Detail

getChangeLogParameters

public ChangeLogParameters getChangeLogParameters()

getDatabase

public Database getDatabase()

getFileOpener

public ResourceAccessor getFileOpener()
FileOpener to use for accessing changelog files.


setCurrentDateTimeFunction

public void setCurrentDateTimeFunction(java.lang.String currentDateTimeFunction)
Use this function to override the current date/time function used to insert dates into the database. Especially useful when using an unsupported database.


update

public void update(java.lang.String contexts)
            throws LiquibaseException
Throws:
LiquibaseException

update

public void update(java.lang.String contexts,
                   java.io.Writer output)
            throws LiquibaseException
Throws:
LiquibaseException

update

public void update(int changesToApply,
                   java.lang.String contexts)
            throws LiquibaseException
Throws:
LiquibaseException

update

public void update(int changesToApply,
                   java.lang.String contexts,
                   java.io.Writer output)
            throws LiquibaseException
Throws:
LiquibaseException

rollback

public void rollback(int changesToRollback,
                     java.lang.String contexts,
                     java.io.Writer output)
              throws LiquibaseException
Throws:
LiquibaseException

rollback

public void rollback(int changesToRollback,
                     java.lang.String contexts)
              throws LiquibaseException
Throws:
LiquibaseException

rollback

public void rollback(java.lang.String tagToRollBackTo,
                     java.lang.String contexts,
                     java.io.Writer output)
              throws LiquibaseException
Throws:
LiquibaseException

rollback

public void rollback(java.lang.String tagToRollBackTo,
                     java.lang.String contexts)
              throws LiquibaseException
Throws:
LiquibaseException

rollback

public void rollback(java.util.Date dateToRollBackTo,
                     java.lang.String contexts,
                     java.io.Writer output)
              throws LiquibaseException
Throws:
LiquibaseException

rollback

public void rollback(java.util.Date dateToRollBackTo,
                     java.lang.String contexts)
              throws LiquibaseException
Throws:
LiquibaseException

changeLogSync

public void changeLogSync(java.lang.String contexts,
                          java.io.Writer output)
                   throws LiquibaseException
Throws:
LiquibaseException

changeLogSync

public void changeLogSync(java.lang.String contexts)
                   throws LiquibaseException
Throws:
LiquibaseException

markNextChangeSetRan

public void markNextChangeSetRan(java.lang.String contexts,
                                 java.io.Writer output)
                          throws LiquibaseException
Throws:
LiquibaseException

markNextChangeSetRan

public void markNextChangeSetRan(java.lang.String contexts)
                          throws LiquibaseException
Throws:
LiquibaseException

futureRollbackSQL

public void futureRollbackSQL(java.lang.String contexts,
                              java.io.Writer output)
                       throws LiquibaseException
Throws:
LiquibaseException

dropAll

public final void dropAll()
                   throws DatabaseException,
                          LockException
Drops all database objects owned by the current user.

Throws:
DatabaseException
LockException

dropAll

public final void dropAll(java.lang.String... schemas)
                   throws DatabaseException
Drops all database objects owned by the current user.

Throws:
DatabaseException

tag

public void tag(java.lang.String tagString)
         throws LiquibaseException
'Tags' the database for future rollback

Throws:
LiquibaseException

updateTestingRollback

public void updateTestingRollback(java.lang.String contexts)
                           throws LiquibaseException
Throws:
LiquibaseException

checkDatabaseChangeLogTable

public void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums,
                                        DatabaseChangeLog databaseChangeLog,
                                        java.lang.String contexts)
                                 throws LiquibaseException
Throws:
LiquibaseException

isSafeToRunMigration

public boolean isSafeToRunMigration()
                             throws DatabaseException
Returns true if it is "save" to migrate the database. Currently, "safe" is defined as running in an output-sql mode or against a database on localhost. It is fine to run Liquibase against a "non-safe" database, the method is mainly used to determine if the user should be prompted before continuing.

Throws:
DatabaseException

listLocks

public DatabaseChangeLogLock[] listLocks()
                                  throws LiquibaseException
Display change log lock information.

Throws:
LiquibaseException

reportLocks

public void reportLocks(java.io.PrintStream out)
                 throws LiquibaseException
Throws:
LiquibaseException

forceReleaseLocks

public void forceReleaseLocks()
                       throws LiquibaseException
Throws:
LiquibaseException

listUnrunChangeSets

public java.util.List<ChangeSet> listUnrunChangeSets(java.lang.String contexts)
                                              throws LiquibaseException
Throws:
LiquibaseException

reportStatus

public void reportStatus(boolean verbose,
                         java.lang.String contexts,
                         java.io.Writer out)
                  throws LiquibaseException
Throws:
LiquibaseException

clearCheckSums

public void clearCheckSums()
                    throws LiquibaseException
Sets checksums to null so they will be repopulated next run

Throws:
LiquibaseException

generateDocumentation

public void generateDocumentation(java.lang.String outputDirectory)
                           throws LiquibaseException
Throws:
LiquibaseException

generateDocumentation

public void generateDocumentation(java.lang.String outputDirectory,
                                  java.lang.String contexts)
                           throws LiquibaseException
Throws:
LiquibaseException

validate

public void validate()
              throws LiquibaseException
Checks changelogs for bad MD5Sums and preconditions before attempting a migration

Throws:
LiquibaseException

setChangeLogParameter

public void setChangeLogParameter(java.lang.String key,
                                  java.lang.Object value)


Copyright © 2010 Liquibase.org. All Rights Reserved.