liquibase / liquibase-gradle-plugin

A Gradle plugin for Liquibase
Other
197 stars 57 forks source link

Liquibase --username argument should be placed after the command #138

Open ZooToby opened 5 months ago

ZooToby commented 5 months ago

For some reason, when the database username is migrate and the username is specified before the command, liquibase will return the following error: Error parsing command line: Expected parameter for option '--username' but found 'migrate'.

example command which causes error:

liquibase --username=migrate --password=1234 --url="jdbc:postgresql://localhost:5432/sample" --changelog-file=path/to/changelog.yaml status

This also appears to affect --reference-username, eg:

liquibase --username=write --password=1234 --url="jdbc:postgresql://localhost:5432/sample" --reference-url="jdbc:postgresql://localhost:5433/sample" --reference-username=local --reference-password=1234 diff

I'm not sure why 'migrate' specifically is causing this error, however if the --username or --reference-username is placed after the command then it runs fine.

If the first command is changed to this it won't cause errors:

liquibase --password=1234 --url="jdbc:postgresql://localhost:5432/sample" --changelog-file=path/to/changelog.yaml status --username=migrate

I'm not sure if this is a documented error but it seems the fix would be to add USERNAME and REFERENCE_USERNAME to the POST_COMMAND_ARGUMENTS array in the LiquibaseCommand.groovy file