should-snapshot-data
The should-snapshot-data
parameter is a Boolean that allows Liquibase to snapshot your database data. The default value is false
.
Uses
You can use the should-snapshot-data
parameter with the generate-changelog command. If you specify shouldSnapshotData=true
, the generate-changelog
command will include insert statements for the data in your database or <loadData>
if the dataDir
argument is set.
Note: The diff-changelog command does not compare data and therefore does not generate the data-related changesets, even if you have shouldSnapshotData=true
.
Setting the should-snapshot-data
parameter
You can set should-snapshot-data
in four ways:
- In the Liquibase properties file
- As a global parameter in the CLI
- As a JVM system property
- As an environment variable (Liquibase Pro)
Liquibase properties file parameter
In Liquibase 4.1+, add the following to Liquibase properties file:
liquibase.shouldSnapshotData
: <true|false>
CLI global parameter
In your command line, use a global parameter with a single Liquibase command:
liquibase --should-snapshot-data
=<true|false>
generate-changelog
--changelog-file=dbchangelog.xml
Java system property
In your command line, use the JAVA_OPTS Environment Variable to set a JVM system property:
Mac/Linux syntax:
JAVA_OPTS=-Dliquibase.shouldSnapshotData
=<true|false>
Windows syntax:
set JAVA_OPTS=-Dliquibase.shouldSnapshotData
=<true|false>
Note: To use a Liquibase command alongside JAVA_OPTS
, add && liquibase <command>
to the end of your input.
Environment variable (Liquibase Pro)
In Liquibase Pro, set an environment variable:
Mac/Linux syntax:
LIQUIBASE_SHOULD_SNAPSHOT_DATA
=<true|false>
Windows syntax:
set LIQUIBASE_SHOULD_SNAPSHOT_DATA
=<true|false>
Note: These environment variable commands only apply to the current shell. If you need to pass an environment variable to a child process without affecting the parent process, you can use the export
command on Mac/Linux or the setx
command on Windows.