How is 'tagDatabase' supposed to work ?!?


I am working currently with the last liquibase distribution. My understanding of the tagDatabase-tag is that it should be allowed with other tags in a changeset. But when running the following changeset

I get an error:

  1. SEVERE 3/12/12 7:11 PM:liquibase: Error thrown as a SAXException: Error parsing line 17 column 29 of resources/00_init.xml: cvc-complex-type.2.4.a: Invalid content was found starting with element 'tagDatabase'. One of '{"":comment, "":createTable, "":dropTable, "":createView, "":renameView, "":dropView, "":insert, "":addColumn, "":sql, "":createProcedure, "":sqlFile, "":renameTable, "":renameColumn, "":dropColumn, "":mergeColumns, "":modifyDataType, "":createSequence, "":alterSequence, "":dropSequence, "":createIndex, "":dropIndex, "":addNotNullConstraint, "":dropNotNullConstraint, "":addForeignKeyConstraint, "":dropForeignKeyConstraint, "":dropAllForeignKeyConstraints, "":addPrimaryKey, "":dropPrimaryKey, "":addLookupTable, "":addAutoIncrement, "":addDefaultValue, "":dropDefaultValue, "":addUniqueConstraint, "":dropUniqueConstraint, "":customChange, "":update, "":delete, "":loadData, "":loadUpdateData, "":executeCommand, "":stop, "":rollback, WC[##other:""], "":modifySql}' is expected.

However, the code runs as soon as I move the tagDatabase into its own changeset. I further note that the tag is then applied to both entries in the databasechangelog-Table. Is that how it is supposed to work?


The XSD does require it to be in its own changeSet. The rationale is that we wanted to be sure that everything would be committed, and since each changeSet runs in its own transaction but may have auto-commiting statements, we can’t guarantee everything will work unless the tagDatabase command is on it’s own. As a side note, it is usually best to have a single command per changeSet to not get into unexpected states with the first statement autocommitting and the second erroring out.

It is fine that it marks both changeSets with the tag, the rollback takes the execution order and execution date into account to know where it should rollback to.