Quantcast
Channel: Liquibase Forums
Viewing all articles
Browse latest Browse all 2993

Re : "runalways" changesets seem to break rollback functionality

$
0
0
Thanks Daniel.

We currently have the tag being performed after the liquibase update from a Bash script in production, e.g.:

java -jar ${LIQUIBASEJAR} --driver=${LBDRIVER} --classpath=${LBCP} --url=${LBURL} --username=${LBUNAME} --changeLogFile=${LBCHANGELOG} tag ${BUILDNO}

This way, whenever we install a build, we get the tag of the build number added at the end of the update process. I tried adding in a single changeset to tag the database state in between my usual updates and my "runalways" updates using the changelog params to pass in the build number to the changelog , e.g.:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <databaseChangeLog
  3. xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
  6. http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

  7. <include file="updates.xml" relativeToChangelogFile="true"/>
  8. <changeSet id="tag" runAlways="true" author="me">
  9. <validCheckSum>ANY</validCheckSum>
  10. <tagDatabase tag="${build.number}"/>
  11. </changeSet>
  12. <include file="always.xml" relativeToChangelogFile="true"/>

  13. </databaseChangeLog>

This works, but then leaves us with a single changeset that is "RERAN" each time the update is performed, so we have the same problem. One changeset that has it's "tag" column overwritten repeatedly, losing the ability to revert to previous tags.

Putting in a new changeset for each build isn't really practical, as we use a Continuous Integration server to produce the builds. I'd have to write something to manipulate the changelogs as part of the build process, which I'd like to avoid if possible.

The only thing I can thing that would satisfy my use case at this point would be to manipulate the databasechangelog table outwith liquibase, and add my tag to the most recently executed changeset that wasn't from the "always.xml" file. This seems a little overkill, and has the potential to cause me problems if the databasechangelog table schema get's altered at some point.

I can't help but feel that I must still be missing something, as I'm not convinced that this is a particularly obscure use case.

Viewing all articles
Browse latest Browse all 2993

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>