I have been able to do rollback to tag with just schema changes, but I ran into a scenario that does not work when I mix in stored procedures.
I am using SQL changelogs against an Oracle database. Here is the scenario:
Release 1.0.0
I have a script r-1.0.0.sql that contains creates a table, and a script proc.sql that creates a stored procedure. The proc changeset is tagged as runOnChange=true.
I am happy with the changes, and I tag the database with tag 1.0.0
In the end the DATABASECHANGELOG table shows:
1 - r-1.0.0.sql-EXECUTED
2 - proc.sql-EXECUTED-(tag)1.0.0
Release 2.0.0
I have a script r-2.0.0 that renames a column, and I also updated proc.sql with the new column name. After running this, DATABASECHANGELOG is:
1 - r-1.0.0.sql-EXECUTED
4 - proc.sql-RERAN-(tag)1.0.0
3 - r-2.0.0.sql-EXECUTED
You notice that the re-ran proc script has a new number, but it still keeps the 1.0.0 tag
If now I want to rollback to tag 1.0.0, the rollback command does nothing, because tag 1.0.0 corresponds to the very latest change in the log.
This seems to be by design. Is there a different way to organize my changes to make this work?