changelog-file

Liquibase changelog file is a root file that contains a record of all your database changes (changesets). 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

For more information, see Working with Command Parameters. You can set this parameter in the following ways:

Option Syntax
Liquibase properties file
liquibase.changelogFile: <string>
Global CLI parameter
liquibase
 --changelog-file=<string> update
 --changelog-file=mychangelog.xml

JVM system property

JAVA_OPTS Environment Variable

macOS/Linux:
JAVA_OPTS=-Dliquibase.changelogFile=<string>
Windows:
set JAVA_OPTS=-Dliquibase.changelogFile=<string>
Liquibase Environment Variables macOS/Linux:
LIQUIBASE_CHANGELOG_FILE=<string>
Windows:
set LIQUIBASE_CHANGELOG_FILE=<string>

Note: These commands only apply to the current shell. To set permanent environment variables, see Liquibase Environment Variables.

Related links