Reputation: 6591
We need to interpret/override the database name in the liquibase.properties
file.
Here are two things we've tried:
liquibase --url="${referenceUrl}" update
liquibase --database-name=BASELINE update
Neither of those override the database name.
tldr;
The process without Liquibase is as follows:
The referenceUrl
keeps the baseline (db named "BASELINE"). Then Liquibase records the drift and commits changelogs. But after that the baseline database needs to be updated which should be as easy as switching the database name (since all other properties, url, host, password match between the dbs).
Here are the commands that do work. Note how we needlessly have to have a second properties file just to switch url
with referenceUrl
.
# generate change log from work developer did on db
liquibase --changeLogFile="logs/v<YYYYMMDDHHII>.xml" generateChangeLog;
# update "baseline" reference database
liquibase --defaults-file=baseline_reference.properties update;
Question is:
How to update reference url without a second properties file?
Upvotes: 0
Views: 25
Reputation: 6591
The fact that Liquibase has referenceUrl for diff operations but no easy way to say "now update that reference database instead" seems like a design oversight.
Something like this SHOULD exist (but doesn't):
liquibase --target=reference update
# or
liquibase --use-reference-url update
It's especially frustrating because: The reference database info is already in the properties file.
We're just wanting to temporarily switch which database gets updated.
This seems like a common need - update your baseline after confirming the changes look good.
For now we're stuck with either:
Upvotes: 0
Reputation: 1089
Liquibase does not allow overriding the reference URL (or its derived properites such as databaseName
) via CLI.
Consider changing your liquibase.properties to use a variable for the reference URL, for example:
referenceUrl=${REFERENCE_URL}
And when running liquibase, supply the environment variable or JVM system property:
REFERENCE_URL=jdbc:yourReferenceDb liquibase update
or
liquibase -DREFERENCE_URL=jdbc:yourReferenceDb update
Upvotes: 0