generate-changeset-created-values

The generate-changeset-created-values global parameter is a Boolean that determines whether Liquibase adds timestamps to changesets in the changelog it generates when you run the diff-changelog command and generate-changelog command. By default, it is set to false.

Uses

If you use the diff-changelog or generate-changelog commands to create a changelog with the contents of your database, you can set generate-changeset-created-values to true to include a timestamp in the header of each changeset in your changelog. The timestamp is stored as the value of the created parameter and uses the format YYYY-MM-DD hh:mm-ssss.

Syntax

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

Option Syntax
Liquibase properties file
liquibase.generateChangesetCreatedValues: <true|false>
Global CLI parameter
liquibase
 --generate-changeset-created-values=<true|false> generate-changelog
 --changelog-file=mychangelog.xml

JVM system property

JAVA_OPTS Environment Variable

macOS/Linux:
JAVA_OPTS=-Dliquibase.generateChangesetCreatedValues=<true|false>
Windows:
set JAVA_OPTS=-Dliquibase.generateChangesetCreatedValues=<true|false>
Liquibase Environment Variables macOS/Linux:
LIQUIBASE_GENERATE_CHANGESET_CREATED_VALUES=<true|false>
Windows:
set LIQUIBASE_GENERATE_CHANGESET_CREATED_VALUES=<true|false>

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

Output

If you run a command like generate-changelog with generate-changeset-created-values set to true, the output is:

BEST PRACTICE: The changelog generated by diff-changelog/generate-changelog should be inspected for correctness and completeness before being deployed.
Generated changelog written to C:\<filepath>\dbchangelog.xml
Liquibase command 'generate-changelog' was executed successfully.

The generated changelog includes a created parameter that has a timestamp:

<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog
	xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
	xmlns:pro="http://www.liquibase.org/xml/ns/pro"
	xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
		http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
		http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
		http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">
	<changeSet author="adrian (generated)" created="2021-08-02 16:26-0400" id="1627936002055-1">
		<createTable tableName="TEST_TABLE">
			<column name="TEST_ID" type="INT">
				<constraints nullable="false" primaryKey="true" primaryKeyName="PK_TEST_TABLE"/>
			</column>
			<column name="TEST_COLUMN" type="VARCHAR(2147483647)"/>
		</createTable>
	</changeSet>
</databaseChangeLog>

Related links