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
You can set this parameter in the following ways:
Option | Syntax |
Liquibase properties file (defaults file) | liquibase.outputFile: <string> |
Global flow file argument | globalArgs: { output-file: "<string>" } |
Global CLI parameter | liquibase --output-file=<string> diff --changelog-file=example-changelog.xml |
JVM system property (JAVA_OPTS environment variable) | Unix: JAVA_OPTS=-Dliquibase.outputFile=<string> Windows: JAVA_OPTS=-D"liquibase.outputFile"=<string> |
Liquibase environment variable |
|
For more information, see Working with command parameters.