Maven rollback

Last updated: July 14, 2025

The Maven rollback goal allows you to roll back change you made to the database. It also marks changesets that were deployed as unapplied. You can roll back changesets using the liquibase.rollbackCount, liquibase.rollbackTag, or liquibase.rollbackDate attributes.

Uses

The Maven rollback goal is typically used when you want to revert changes in your database. There are three rollback modes:

  • liquibase.rollbackCount:Reverts a specified number of changesets sequentially, starting with the most recent changes and working backward until the value specified is reached.

  • liquibase.rollbackTag:Reverts all changes that were made to the database after the specified tag.

  • liquibase.rollbackDate:Reverts all changes made to your database from today's date to the date and time you specify.

The impacts of rollback

Using the rollback goal comes with risks of unintended consequences. For this reason, it is best practice to run the rollbackSQL goal because it allows you to inspect the rollback SQL and search for any potential mistakes before you execute rollback.

Maven configuration

You can configure Liquibase Maven in multiple ways. You can pass arguments like <changeLogFile> in Maven directly in your pom.xml file, in a liquibase.properties file referenced in your POM, as environment variables, or as JVM system properties. To learn about each file's syntax, see Maven Properties.

Tip: For more information about the Maven configuration, see Configuring Maven.

Running the rollback Maven goal

Running the rollback goal requires a Maven project to be implemented. Before running the rollback goal, you can run the history goal to see all your previously executed changes.

To run the rollback goal with the liquibase.rollbackCount attribute, type the following in your command prompt: mvn liquibase:rollback -Dliquibase.rollbackCount=3

Note: Enter the value you want to use in place of 3.

To run the rollback goal with the liquibase.rollbackTag attribute, type the following in your command prompt: mvn liquibase:rollback -Dliquibase.rollbackTag=version1

Note: Enter the name of the tag you want to use in place of version1. Alternatively, you can specify two properties in your pom.xml file under the <properties></properties> in the <project></project> level:

<liquibase.tag>v3.2.1</liquibase.tag> <liquibase.rollbackTag>${liquibase.tag}</liquibase.rollbackTag>

To run the rollback goal with the liquibase.rollbackDate attribute, type the following in your command prompt: mvn liquibase:rollback -Dliquibase.rollbackDate=2020-11-26

Note: Enter the date you want to use in place of 2020-11-26. There are several ways to revert your changes with the liquibase.rollback-to-date attribute. You can use YYYY-MM-DD HH:MM:SS or YYYY-MM-DD'T'HH:MM:SS formats to specify both date and time. Also, you can specify date or time only.

Maven rollback

Required Maven rollback configuration attributes

Attribute

Definition

liquibase.rollbackCount

Defines the number of changesets to roll back. Default value is: 1.

liquibase.rollbackDate

Defines the date for which you want to roll back the database. The format of the date must match either an ISO date format or that of the DateFormat.getDateInstance() for the platform the plugin is being executed on.

liquibase.rollbackTag

Defines the tag for which you want to roll back the database.

Maven rollback output

Starting Liquibase at 08:06:13 (version 4.1.1 #10 built at 2020-10-12 19:24+0000) [INFO] Parsing Liquibase Properties File local.liquibase.properties for changeLog parameters [INFO] Executing on Database: jdbc:oracle:thin:@localhost:1521/ORCL [INFO] Successfully acquired change log lock [INFO] Reading from DATABASECHANGELOG Rolling Back Changeset:dbchangelog.xml::1606322157619-2::Nataliya (generated) Rolling Back Changeset:dbchangelog.xml::1606322157619-12::Nataliya (generated) [INFO] Successfully released change log lock [INFO] ------------------------------------------------------------------------ [INFO] [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 6.038 s [INFO] Finished at: 2020-11-26T08:06:15-06:00 [INFO] ------------------------------------------------------------------------