applyToRollback property ignored when rollback changes are specified
Description
Environment
All
Attachments
1
- 24 Aug 2014, 05:51 PM
Activity
Show:
Nathan Voxland October 9, 2014 at 8:40 PM
Merged pull request
Daniel Morton August 24, 2014 at 6:12 PM
I created a github pull request to address this issue ( https://github.com/liquibase/liquibase/pull/304 ).
When a modifySql element is included in a changeset (with applyToRollback set to false or omitted) and a rollback element is specified with changes necessary to rollback the changeset, the children of the modifySql element (append, replace, etc.) are always applied to the rollback steps defined.
If the rollback element is not specified and liquibase is allowed to generate the rollback SQL on its own, the children of modifySql are selectively applied based on the applyToRollback attribute (as per the changes in https://liquibase.jira.com/browse/CORE-457 ).
Presumably, both these scenarios should respect the applyToRollback attribute.
Attached is a changelog.xml file intended to be used with PostgreSQL, that illustrates this problem. A table is created, the SQL ' WITHOUT OIDS' is appended via a modifySql element with the applyToRollback attribute set to false. A custom rollback tag is supplied containing a dropTable element. When the rollback is executed, the resulting statement is 'DROP TABLE test_table WITHOUT OIDS;'. Granted liquibase could generate this rollback step automatically, but this is not always the case.