Hi, I am using tag command to rollback with xml formatted for postgesql, but it executes rollback with no errors and does absolutely nothing. Any idea what it could be? the rollbackCount command if it works and does the rollback correctly.
Hi, I am using tag command to rollback with xml formatted for postgesql, but it executes rollback with no errors and does absolutely nothing. Any idea what it could be? the rollbackCount command if it works and does the rollback correctly.
It will depend on what change-type you are trying to rollback. Not all change-types have “auto-rollback”. If a change-type does not have “auto-rollback” you will need to provide the rollback sql, something like this:
<rollback>
DROP TABLE test_employee PURGE;
</rollback>
You can check whether a change-type has auto-rollback here:
Thank you very much @daryldoak , but what is happening to me is that when I execute rollbackCount, the rollback works perfect, but when I execute rollback , after excecute tag , doesn’t work. I find it weird that rollback doesn’t work like this, any ideas?
Hello @ilasso
Could you please help us with the command you are using? Are you rolling back only single changeset (count =1)?
Also please shre the Liquibase version you are using for this execution.
Thanks,
Rakhi Agrawal
thanks @rakhi ,
version:
Liquibase Version: 4.4.3
Liquibase Community 4.4.3 by Datical
If it is happening to me in this case with only one change set, but before I also had other changesets but I eliminated them because I thought it was in one of them, in this case it is a CREATE TABLE.
Right now I used an additional changeset with Database tag at the start of the changelog and it worked for me. However I thought it should work without having to define the tagDatabase.
Thanks @ilasso for the details.
From what you shared, I understand that you are following below steps-
Please correct me if I understand this wrong.
If I understand it correct, then Liquibase is actually rolling back to tag “sprint01_01”. A tag acts like a checkpoint to which you can anytime rollback your database to. Read more about it here.
Let’s assume, you have executed following steps -
In this case when you perform “Liquibase rollback to ‘sprint01_01’”, then Liquibase will undo all the changesets executed as a part of step 3.
However in your case Liquibase doesn’t find any changesets to undo while rolling back to tag “sprint01_01”. You could maybe try something like this -
This will rollback and get your DB at state after step 2.
Please let us know if any other queries.
Thanks!
Rakhi Agrawal
You’re right @rakhi , I was using it wrong, the command tag goes first, Thank you very much.
No worries. Happy to help!