(I apologize for my bad English)
At the moment, I think there are only two positions about rollback support to drop statements:
- If rollback proces finds any drop statement, it gives a error/exception and prevents the generation of sql file in rollbackFutureDatabase. (the only aviable option)
- The explained option in http://liquibase.org/forum/index.php?topic=88.0 that brougth abouthttp://liquibase.jira.com/browse/CORE-423: to use metadata in dabasechangelog table to take a database snapshot)
But I think we have forgotten the most simple option and, from my point of view, it’s the most useful:
3) To do the inverse (rollback) statement to any add/create/drop/… statement without worrying about the unstable future state of database if rollback process is launched.
I work with DDL software units. Each DDL unit means a set of changes in a particular database. A DDL unit is defined by a name and a version and is referred to a Web Service software unit (similar name, same version). Logically, this service needs a DDL structure (and maybe a DML) already implemented. I use liquibase Ant tasks to automate all the DDL operations (install/update/rollback), generating sql files over persistance files. These sql files have to check by a DBA.
In this ambient, working with sql files, version update and its corresponding rollback is mandatory to update/downgrade (rollback) DDL software according to Web Service deployment.
A version update sql file (diffDatabaseToChangeLog following to updateDatabase) can have a drop statements if the developer has considered necessary, and the corresponding rollback sql file (rollbackFutureDatabase) has to have all the inverse statements to downgrade the version when it is necessary. Working with sql files and diffDatabase task, we have the database snapshot in the generated sql files, we don’t need it in another place.
My solution:
To put a option in the rollbackFutureDatabaseant tasks to can choose the three options:
- Exception if any drop statement finds (the only current option)
- To use metadata in dabasechangelog table to rollback with the previous database snapshot (very difficult)
- Do all the rollback statements, include drop statements.