updateToTagSQL and updateSQL


In my setup I have multiple databases managed with liquibase scripts. As I have many of the DBs I don’t create DB tag for each of the databases for each of the product release (I add tag a DB only when there were some changes to the schema in the current product release).

I have a following steps executed in my build:

Let’s say that we have a database DB1, which has following change sets:

  • createTable1

  • tag 1.4.0

  • modifyTable1

and that we had a product released with version 1.5.0 (i.e. there are other databases that are tagged with 1.5.0 but not this one as there were no changes in this particular DB since 1.4.0 product release).

When I run following steps:

  1. “Simulate” having a production DB in a specific product release version. I don’t have a current DB1 db tag, only the product release version - 1.5.0:

liquibase updateToTagSQL 1.5.0 (with URL “offline:postgresql?changeLogFile=baseChangeLog.csv”)

  1. Generate update SQL script based on “baseChangeLog.csv” (so it can be applied manually against the production database):

liquibase updateSQL (with URL “offline:postgresql?changeLogFile=baseChangeLog.csv”)

I would expect that liquibase will notice that the latest tagged version is 1.4.0 (based on the csv generated in step #1) and the second step will include all modifications after tag 1.4.0. Unfortunately, instead I get an empty SQL.

Any hints what I am doing incorrectly?

I was thinking about auto-detecting what is the latest tag for a given database to use a latest tag for updateToTagSQL instead of the latest product release version. I tried to check the generated baseChangeLog.csv file but it’s tag column is always empty.

I could also add tags for every release, but as I am trying to automate release procedure, it’s quite complex to modify existing SQL scripts to add another tag command (we I am using Groovy DSL and multiple includes).

Any suggestions are welcomed!

Best regards,