Pass a parameter to Liquibase changeset when running using SQLcl

109 Views Asked by At

I use SQLcl + Liquibase to deploy changes to Oracle Database. I have the following changeset in YAML format (to compile a package spec for utils_pkg:

  - changeSet:
      id: ${changesetOwner}.utils_pkg_s
      author: def_author
      runOnChange: true
      changes:
        - sqlFile:
            path: utils_pkg_s.sql
            splitStatements: true
            endDelimiter: /
            relativeToChangelogFile: true

Currently to pass a value for changesetOwner I have to generate properties file on the fly and call liquibase update passing properties file in the following manner:

lb update -default-schema-name ORDERS -changelog-file main.yaml -defaults-file deployment.properties -liquibase-schema-name DEPLOYMENT

This method works fine for me but generating properties file seems an overhead. Is there any chance to pass a substitution parameter, for instance, and then use it the same way? Something like this (assume it is some sql script contents):

define changesetOwner = ORDERS
lb update -default-schema-name ORDERS -changelog-file main.yaml -liquibase-schema-name DEPLOYMENT

And then somehow reach out to changesetOwner.

0

There are 0 best solutions below