I'm using Liquibase in a project with a Spring environment. However the rollback functionality doesn't seem to work.
I suspect rollback functionality isn't supported when using Spring to run Liquibase since the manual says:
LiquiBase allows you to undo changes you have made to your database, either automatically or via custom rollback SQL. Rollback support is available in command line, Ant, Maven, and Grails.
However find it hard to believe rollbacks aren't possible in this setup. So the question is: "Why are rollbacks not working and how can I get rollbacks working?"
EDIT:
I now realize I should have asked the question a bit different. The kind of rollbacks I would like to have are the rollbacks that happen if something goes wrong when migrating.
I tried to use transactions (as these are there for I assume), but this didn't have the wanted effect.
Example of a change set that will go wrong:
<changeSet runInTransaction="true">
<createTable tableName="table1">
<column name="a" type="int"/>
</createTable>
<createTable tableName="table1">
<column name="a" type="int"/>
</createTable>
<createTable tableName="table2">
<column name="a" type="int"/>
</createTable>
</changeSet>
When I run the example change set, Liquibase manages to create table1 but when it tried to create another table with the same name it fails (obviously). The created table doesn't get deleted and is persisted to the database.
Looking at the Liquibase manual I notice that:
runInTransaction
Should the changeSet be ran as a single transaction (if possible)? Defaults to true. Warning: be careful with this attribute. If set to false and an error occurs part way through running a changeSet containing multiple statements, the LiquiBase databasechangelog table will be left in an invalid state Since 1.9
I'm using MySQL, but the change set has to work with MSSQL and Oracle too.
I'm also using Spring's transactions, and these work perfect, any ideas on how to get both the awesomeness of Liquibase and those awesome (database independent) transactions?