output-file

To send your command output to a file, use the output-file parameter. The output-file parameter works with the diff command, snapshot command, and Liquibase SQL commands.

  • You can use the output-file parameter with diff and snapshot commands to gather the information about the current state of a database and send this information as a text-based version of the schema to a file.
  • You can use the output-file parameter with Liquibase SQL commands to receive an SQL script in a file instead of having it in the CLI.

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.

An example of running the output-file parameter

liquibase --output-file=../the/path/to/my/output/file update-sql

An example of running both output-file and log-file parameters

To get the log and output information from a command, use the output-file and log-file parameters simultaneously:

liquibase --output-file=mysnapshot.json --log-level=debug --log-file=liquibase.log snapshot

Syntax

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

Option Syntax
Liquibase properties file
liquibase.outputFile: <string>
Global CLI parameter
liquibase
 --output-file=<string> diff
 --changelog-file=mychangelog.xml

JVM system property

JAVA_OPTS Environment Variable

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

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

Related Links