Liquibase® version 3.8.5 is now available! Get it for free.
2018 XML Announcement
News All Previous Posts >>

Subscribe for email updates

- and/or -

generateChangeLog Ant Task

Generates changelog to re-create an existing database.

Parameters

Attribute Description Required
classpathref A reference to the classpath used to run the task with. No
databaseref A reference to the database that Liquibase will connect to. Yes, unless a nested <database> element is present.
promptOnNonLocalDatabase If set to true a dialog box with warn you if you attempt to run the Liquibase against a database that is not on localhost No; default is false.
outputFile Deprecated: Where to save the generated change log file. No
driver Deprecated: The name of the database driver to connect with. No
url Deprecated: The database URL. No
username Deprecated: The database username to connect with. No
password Deprecated: The password to use when connecting to the database. No
defaultSchemaName Deprecated: Schema read objects from. No
currentDateTimeFunction Deprecated: Overrides current date time function used in SQL. Useful for unsupported databases No
databaseChangeLogTableName Deprecated: Overrides the name of the databasechangelog table to use Since Liquibase 1.9 No
databaseChangeLogLockTableName Deprecated: Overrides the name of the databasechangeloglock table to use Since Liquibase 1.9 No
logLevel Deprecated: Specifies one of the following logging levels: debug, info, warning, severe, off. The default level is info. No

Parameters Specified as Nested Elements

xml, yaml, json, or txt

This task is capable of generating change log files in multiple formats. At least one of these elements is required.

Attribute Description Required
outputfile The location to write the changlog file to. Yes
encoding The file encoding to use for the output file. No. Defaults to system encoding
<liquibase:xml outputfile="/path/to/output/changelog.xml" encoding="UTF-8"/>

classpath

The classpath used to run the task with. Optional.

Database

Required unless a databaseref attribute is given. See database data type.

ChangeLogParameters

Optional. See change log parameters

Examples

<liquibase:generateChangeLog classpathref="classpath">
    <liquibase:database driver="${driver.class}" url="${jdbc.url}" user="${jdbc.user}" password="${jdbc.user}"/>
    <liquibase:xml outputfile="/path/to/output/changelog.xml" encoding="UTF-8"/>
</liquibase:generateChangeLog>

Generates a changelog file for the database in XML format.

<liquibase:generateChangeLog classpathref="classpath">
    <liquibase:database driver="${driver.class}" url="${jdbc.url}" user="${jdbc.user}" password="${jdbc.user}"/>
    <liquibase:xml outputfile="/path/to/output/changelog.xml" encoding="UTF-8"/>
    <liquibase:yaml outputfile="/path/to/output/changelog.yaml" encoding="UTF-8"/>
</liquibase:generateChangeLog>

Generates the change log in both XML and YAML format.