1
votes

my problem is that liquibase is not rolling back some of my changesets that have been executed after a tag was set on the change set i am trying to rollback too.

For example I have created two changesets (A and B) which execute as normal. and then i have created another changeset which sets the tag of changeset B to release1. and this changeset also works as expected. however i then execute another 5 changesets all with rollback commands. and these also execute fine.

Now the problem comes when i run the following:

java -jar liquibase.jar --changeLogFile=..\database\changelog-create.xml rollback release1

Now shouldn't this rollback any changesets that were executed after the release1 tag was executed?

If so, this is my problem, they are not being rolled back. but in console i get Rollback was successful.

1
I understand the description of rolling back to a tag (see here) in the same way. So maybe something else is going wrong. You can try to change the log level to debug (add --logLevel=debug to your command line) and see if that gives more details...Jens
Thanks for the reply @Jens I have tried adding in this debug line but this provides no additional info. i think this only works when there is an exception. im not too sure to be honest but it didn't do anything for meShaun Lavelle
You should definitively see a difference in the amount of log messages that liquibase provides. Otherwise the switch for debug log-level did not work!Jens
@Jens Okay so I got it to display all the debug messages. and it all seems fine, except none of the sql rollbacks seem to be executing. I'm not sure if they are supposed to show up in debug or not, but they aren't doing.Is is possible you could provide a correct way to set a tag please? the current way i am doing it is as follows 'UPDATE DATABASECHANGELOG SET TAG = 'release1' WHERE DATEEXECUTED = (SELECT MAX(DATEEXECUTED) FROM (SELECT DATEEXECUTED FROM DATABASECHANGELOG) AS X) AND ORDEREXECUTED = (SELECT MAX(ORDEREXECUTED) FROM (SELECT ORDEREXECUTED FROM DATABASECHANGELOG) AS Y);'Shaun Lavelle
Something else i have noticed is that... the only thing being rolled back is the changeset that sets the tag. I would expect this to be rolled back as is was executed 3rd whereas the changelog with tag was executed 2nd. But once again i cant see why the other changesets aren't being rolled back. The other changesets were however executed in a different command afterwards.Shaun Lavelle

1 Answers

0
votes

So I found the problem.. The following line in my command line --changeLogFile=..\database\changelog-create.xml Was wrong. The changeLogFile should be the one you want to start the rollback from. Whereas i provided the changelog file with the tag.