How to rollback to a tag?

Hi all. I have a question about rollback to a tag version.

I use Liquibase2.0-rc7 and I have these items into DATABASECHANGELOG table:

]
FILENAME | TAG
script1.xml | tag1 --> this script creates table 1
script2.xml | tag2 --> this script creates table 2
script3.xml | null --> this script creates table 3
script4.xml | null --> this script creates table 4

Now I want to rollback to tag1, so I use this command line:

    java -jar ... --changeLogFile="script4.xml" rollbackSql tag1

which returns:

    DROP TABLE4

but I 'd like to delete table2 and table3 also, because I’d like to get the same database schema
when It was tagged with tag1 label.

Do I have to call the same line command with --changeLogFile=“script3.xml” and --changeLogFile=“script2.xml” params?

I hope to get all rollback script (DROPT TABLE4, DROP TABLE3, DROP TABLE2) in one way. Is it possible?

Thx all 4 your help.

You had ran liquibase to do updates pointing directly to script1.xml, script2.xml etc?  What usually works best is to create a single script.master.xml file with etc. in it.  That way you can always just point at that script.master.xml and it will update your database from all the scripts.  With this setup, you can also call --changeLogFile=script.master.xml rollbackSql tag1 and it will roll back table 4,3,2 and 1. 

The way the rollback command works is it needs the original changeSet to be available in the passed changeLogFile so it knows how to construct the rollback command.  You should be able to create a new master script and point to your old scripts and be able to use rollback without any changes to your database or your existing script.  Let me know if you can’t get it to work.

Nathan

Originally posted by: Nathan
You had ran liquibase to do updates pointing directly to script1.xml, script2.xml etc?  What usually works best is to create a single script.master.xml file with etc. in it.  That way you can always just point at that script.master.xml and it will update your database from all the scripts.  With this setup, you can also call --changeLogFile=script.master.xml rollbackSql tag1 and it will roll back table 4,3,2 and 1. 

Thanks Nathan, I had a several file but I need a single master file to work well. If I use a single master file rollback action to a tag
works correctly.

Thanks a lot 4 your help.

E.