Liquibase auto-rollback if fails

Hello, i want to know if is possible how to rollback to a tag when liquibase detects an error.

My changelog-master is like this

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="" xmlns:ext="" xmlns:pro="" xmlns:xsi="" xsi:schemaLocation="">

<include file="liquibase/db.changelog-3.2.0.xml" />
<changeSet id="tagDataModel-3.2.0">  
	<tagDatabase tag="3.2.0"/>  
<include file="liquibase/db.changelog-3.3.0.xml" />
<changeSet  id="tagDataModel-3.3.0">  
	<tagDatabase tag="3.3.0"/>  


If for example db.changelog-3.3.0.xml fails, i want to automatically rollback to db.changelog-3.2.0.xml.

Is there any option to handle this in my changelog-master?

I don’t believe there is a way to automatically rollback on failure. I think you need to run a liquibase rollback command after the failure, which will allow you to rollback to a prior changeset.

You need to add this to the changeset in db.changelog-3.3.0.xml, settiing the changeset ID and Author that you have defined in db.changelog-3.2.0.xml.

<rollback changeSetId="changesetID" changeSetAuthor="changesetauthor"/>

Then run the liquibase rollback command.

As per my knowledge, there is no functionality as “Auto rollback the database changes”. Liquibase supports creating auto rollback statements. If you want to rollback to a previous changeset on failure of a next one, you need to have a rollback statement written.
Please refer to this documentation of liquibase auto rollback for better explanation.

Please let us know if you need more help.

Rakhi Agrawal