Liquibase® version 3.8.2 is now available! Get it for free.
2018 XML Announcement
News 5 Ways to Fix a Bad Database Change in Liquibase
04 Dec 2019

- and/or -

All Previous Posts >>

rollbackDatabase Ant Task

Rolls back database changes. See rollback page for more information.

Parameters

Attribute Description Required
changeLogFile The change log file to rollback. Yes
contexts A comma separated list of contexts to execute. If not specified, all contexts are run. No
outputFile If specified, Liquibase will save the rollback SQL statements to the specified file rather than executing them in the database. No
outputEncoding The character encoding to use when writing SQL statements to output file. No; defaults to system encoding.
promptOnNonLocalDatabase If set to true a dialog box with warn you if you attempt to run the Liquibase against a database that is not on localhost No; default is false.
classpathref A reference to the classpath used to run the task with. No
databaseref A reference to the database that Liquibase will connect to. Yes, unless a nested <database> element is present.
rollbackTag Tag to roll back to. Exactly one of these attributes must be provided.
rollbackDate Date to roll back to.
rollbackCount Number of changeSets to roll back.
driver Deprecated: Name of the database driver to connect with. No
url Deprecated: Use <database>'s url attribute instead. The database URL No
username Deprecated:The database username to connect with No
password Deprecated:The password to use when connecting to the database No
defaultSchemaName Deprecated:Schema to use by default for managed database objects and Liquibase control tables No
currentDateTimeFunction Deprecated: Overrides current date time function used in SQL. Useful for unsupported databases No
databaseChangeLogTableName Deprecated: Overrides the name of the databasechangelog table to use No
databaseChangeLogLockTableName Deprecated: Overrides the name of the databasechangeloglock table to use No
logLevel Deprecated: Specifies one of the following logging levels: debug, info, warning, severe, off. The default level is info. No

Parameters Specified as Nested Elements

classpath

The classpath used to run the task with. Optional.

database

Required unless a databaseref attribute is given. See database data type.

changelogparameters

Optional. See change log parameters

Examples

<liquibase:rollbackDatabase rollbackCount="2" changelogfile="/path/to/changelog.xml">
    <liquibase:database driver="${db.driver}" url="${db.url}" user="${db.user}" password="${db.password}"/>
</liquibase:rollbackDatabase>

Rollback the last 2 change sets in the given change log file.

<liquibase:rollbackDatabase rollbacktag="my-db-tag" changelogfile="/path/to/changelog.xml">
    <liquibase:database driver="${db.driver}" url="${db.url}" user="${db.user}" password="${db.password}"/>
</liquibase:rollbackDatabase>

Rollback change sets to the given tag.

<liquibase:rollbackDatabase rollbackDate="2014-05-28" changelogfile="/path/to/changelog.xml">
    <liquibase:database driver="${db.driver}" url="${db.url}" user="${db.user}" password="${db.password}"/>
</liquibase:rollbackDatabase>

Rollback change sets to the given date/time.