I have a generic command line that I build in order to support deployment. This includes additional command line options via -D<parameter>=<value>
, which is causing some issues since the behavior differs for the available commands.
Tested against
Liquibase Version: 4.29.2
These all work;
liquibase update -Dproperty1=value1
liquibase rollbackcount 1 -Dproperty1=value1
liquibase changelog-sync -Dproperty1=value1
These do not work;
liquibase clear-checksums -Dproperty1=value1
liquibase release-locks -Dproperty1=value1
Error returned;
Unexpected argument(s): -Dproperty1=value1
For detailed help, try 'liquibase --help' or 'liquibase <command-name> --help'
Is this expected behavior? Whilst I understand that the additional options being provided here are not applicable for both release-locks
and clear-checksums
, would it not be better to ignore them rather raise an error with “Unexpected argument{s)”?
Test scripts
liquibase.properties
classpath: .
driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
url: jdbc:sqlserver://localhost:1433;databaseName=test;integratedSecurity=true;encrypt=true;trustServerCertificate=true
logLevel: info
changeLogFile: root.xml
root.xml
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.8.xsd">
<changeSet author="x" id="1" runOnChange="true">
<sql>
drop synonym if exists synonym1;
CREATE SYNONYM synonym1 FOR [${property1}].[dbo].[TEST1]
</sql>
<rollback>
</rollback>
</changeSet>
<changeSet author="x" id="2" runOnChange="true">
<sql>
drop synonym if exists synonym2;
</sql>
<sqlFile
path="synonym2.sql"/>
<rollback>
</rollback>
</changeSet>
</databaseChangeLog>
synonym2.sql
CREATE SYNONYM synonym2 FOR [${property1}].[dbo].[TEST2];
`