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 withdiff
andsnapshot
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) |
|
Global flow file argument (example) |
|
Global CLI parameter |
|
JVM system property (JAVA_OPTS Environment Variable) |
|
Liquibase Environment Variables |
|
For more information, see Working with Command Parameters.