applyToRollback property ignored when rollback changes are specified


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 ).

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.




Daniel Morton


Fix versions

Affects versions