We are upgrading from 1.9.5 (I know!) to 4.6.1 and found that parameter substitution seems to no longer apply to the logicalFilePath attribute of the databaseChangeLog element.
We have multiple changelog files and depend on the logicalFilePath to normalize them regardless of their location. All changelog files have the attribute defined like this:
Hi @jmeyers How were you replacing the ${version} in the 1.9.5 version of Liquibase?
A quick workaround without knowing all the details might be to have a script replace the values before calling Liquibase update and use that new changelog file.
Thanks for the reply. In 1.9.5 it worked by setting 2 parameter values using setChangeLogParameterValue() on the Liquibase object before calling update().
In 4.6.1 the only difference is I call setChangeLogParameter() as the old method no longer exists. One of the parameter substitutions seems to work and one does not. The working one uses “parentDir” to help specify the location of an sqlFile. Here is the whole changelog file:
The only difference I am aware of between the two are: one is in the “header” (i.e. the databaseChangeLog element itself) and one is in the body. I tried different names in case “version” had special meaning, but no joy.
This change in behavior may track back to CORE-1874 when DatabaseChangeLog.load() was modified to extract the logicalFilePath before performing any expression expansion.
Can anyone with internal knowledge of this change or how things should work please comment?
Is there an alternate way to dynamically change the logicalFilePath since expressions don’t seem to apply anymore?
Sometimes I think I am talking to myself in these threads, but at least I can document the process and findings
I believe I have successfully worked around this issue by doing the substitution myself. Setting the DatabaseChangeLog logicalFilePath was not sufficient (apparently a LOT of stuff happens in the constructor) I had to dig through each of the ChangeSet and set the filePath and storedFilePath, then it appears to work like it did years ago.