Understanding Rollback

    I’m not sure that I fully understand how the rollback feature is supposed to work.
Given a simple change log like:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>


If I run:

sh ./liquibase <br>  --defaultsFile=mydb.properties <br>  --changeLogFile=testlog.xml <br> rollbackSQL testlog

I get an error (I get the same error using just rollbackSQL):

Liquibase Home: /home/brucea/liquibase
INFO 4/26/11 5:00 PM:liquibase: Successfully acquired change log lock
INFO 4/26/11 5:00 PM:liquibase: Reading from DATABASECHANGELOG
INFO 4/26/11 5:00 PM:liquibase: Successfully released change log lock
Liquibase Update Failed: Could not find tag ‘testlog’ in the database
SEVERE 4/26/11 5:00 PM:liquibase: Could not find tag ‘testlog’ in the database
liquibase.exception.RollbackFailedException: Could not find tag ‘testlog’ in the database
        at liquibase.changelog.filter.AfterTagChangeSetFilter.(AfterTagChangeSetFilter.java:28)
        at liquibase.Liquibase.rollback(Liquibase.java:292)
        at liquibase.Liquibase.rollback(Liquibase.java:268)
        at liquibase.integration.commandline.Main.doMigration(Main.java:716)
        at liquibase.integration.commandline.Main.main(Main.java:116)

The changelog id “testlog” is clearly there in the DATABASECHANGELOG table.

I am also unclear why I should not to provide a rollback tag at all.
The implication is that a rollback tag is not the same thing as a changeset id.
So what is it?



(Missed your question originally, sorry)

The tag is created via the “liquibase tag” command, and is not connected to the ids at all.


Can give a example of rollback with rollback,on command, 


Here are a few resources:

The Liquibase docs on rollback have a bit about what the rollback command means when you rollback using a tag:


Datical, Inc. http://www.datical.com/

thank you very much! I think I have got it,I should define a tagDatabase. By the way, and is there a completed document of changeSet file? include insert,rollback,tagDatabase and so on.    

http://www.liquibase.org/documentation/rollback.html gives some examples. 

Tagging the database is usually done outside the changelog, like how you do a tag in git/svn/whatever. 

If you want to automatically tag, tagDatabase is documented here: http://www.liquibase.org/documentation/changes/tag_database.html.