changelog-file
The Liquibase changelog file is a root file that contains a record of all your database changes (changesets). For more information on the changelog, please read the overview page here: Changelog.
Uses
The --changelog-file
parameter helps you create a changelog file using the generate-changelog command or diff-changelog command, apply changes to your database, and keep track of your database information.
Use the
generate-changelog
command and the--changelog-file
parameter if you want to capture the current state of a database. The command creates the changelog file with a sequence of changesets, which describes how to re-create your database. Then, you can apply those changesets to any number of databases.
Note: To generate a changelog file using Ant and Maven, run the Ant generateChangeLog task with the outputFile
parameter and the Maven generateChangeLog goal with the outputChangeLogFile
parameter.
Use the
diff-changelog
command with the--changelog-file
parameter to have the information on differences between the two databases you are comparing. The command creates the changelog file containing deployable changesets to synchronize multiple databases.
Tip: To create an empty changelog file, go to your Liquibase directory and create a new text file with the .xml
, .sql
, .yaml
, or .json
extension.
To apply changes related to a specific changelog file, run the changelog-file
parameter and the needed command. You can also set the parameter in the Liquibase properties file.
Tip: For best results, specify all commands and parameters in the --kebab-case
format in the CLI. If your preference is camelCase, it also works in the CLI.
Syntax
You can set this parameter in the following ways:
Option | Syntax |
Liquibase properties file (defaults file) | liquibase.changelogFile: <string> |
Global flow file argument (example) | stages: Default: actions: - type: liquibase command: update globalArgs: { changelog-file: "<string>" } |
Global CLI parameter | liquibase --changelog-file=<string> update --changelog-file=example-changelog.xml |
JVM system property (JAVA_OPTS environment variable) | Unix: JAVA_OPTS=-Dliquibase.changelogFile=<string> Windows: JAVA_OPTS=-D"liquibase.changelogFile"=<string> |
Liquibase environment variables | LIQUIBASE_COMMAND_CHANGELOG_FILE=<true|false> |