Liquibase is an open-source database schema change management system that allows you to simply manage database update revisions. Liquibase runs six basic types of commands:-  update, rollback, snapshot, diff, status, and utility. For example, when you use the update command to deploy your first changes, Liquibase checks the database connection information, including credentials, database URL, and JDBC driver.

Liquibase makes it easy for anyone involved in the application release process to:

  • Eliminate errors and delays when releasing databases.
  • Deploy and roll back changes for specific versions without knowing what has already been deployed.
  • Deploy database and application changes together, so they always stay in sync.


The rollback command is often used to undo any database changes performed after the specified tag. When you run rollback, Liquibase will reverse all deployed modifications until it reaches the tag record in the DATABASE CHANGELOG database.

You can, for example, use the rollback command to undo a sequence of modifications to your database associated with a specific tag, such as a numbered release. If you have labels for rollback tag 1, rollback tag 2, and rollback tag three and need to correct rollback tag 2, the rollback command will rollback tag three first.

It is mandatory to define one of the three constraints below to limit the rollback operation when the condition is satisfied:

  • rollbackTag
  • rollbackCount
  • rollbackDate



  • Database changelog table
    Here, Each changeset is tracked in the table as a row and is identified by the id, author, and filename fields.
Copy to Clipboard


Copy to Clipboard

Rolling Back to a Tag

Here, we define a particular state of our database as a tag. Here, we can refer back to that state. Rolling back to the tag name “2.0” :

Copy to Clipboard

This executes rollback statements of all the changesets completed after tag “2.0”.

Rolling Back by Count

Here, we define how many changesets we need to be rolled back. If we define it to be one, the last changeset executed will be rolled back:

Copy to Clipboard

Rolling Back to Date

Here, we can set a rollback target as a date. Therefore, any changes executed after that day will be rolled back:

Copy to Clipboard


Liquibase helps to automate database migrations. Liquibase allows you to express the database update you wish to make using SQL or various database-agnostic forms such as XML, YAML, and JSON. Furthermore, developers may abstract the database logic to make it exceedingly simple to deploy changes to different database types.

Here we have seen various ways of applying rollback functionality in liquibase. However, using the rollback command risks your database, so it’s essential to look for unintended consequences before executing it.

About The Author

Rollback Functionality with Liquibase

Minna Niju

Cloud Dev-Ops Engineer | Cloud Control

Cloud DevOps Engineer with more than 1 years of experience in supporting, automating, and optimizing deployments to hybrid cloud platforms using DevOps processes, tools, CI/CD, containers, and Kubernetes in both Production and Development environments.