1
votes

In liquibase, "author" is normally hardcoded in the changeset. But we want to set it to the db user against which the changeset is being run. So we will have the author dev_schema in dev, and prod_schema in prod and so on. The db user are not known beforehand, so we like to set at runtime automatically from --username option of liquibase connection string.

./liquibase.bat --driver=oracle.jdbc.OracleDriver --changeLogFile="changelog.xml" --url="jdbc:oracle:thin:@localhost:1521:xe" --username=dev_schema ...

In the changeset tag I set the attribute author to ${username} but it is not picked up.

<changeSet author="${username}" ...

Also tried setting the environment variable, which worked, but then you have to set the same username twice. There is also a risk that if someone uses a different username, liquibase will fail to execute due to checksum failure.

Is that possible? Alternatively, any way around?

1
You could create your own extension and override the Change and then modify it yourself... - Jens

1 Answers

0
votes

I guess that username is liquibase's system parameter and it is not used in changelog for placeholder replacement. Try to specify parameter like java param -Dusername=<your user> and let's see what will happen.