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 -

diffDatabase Ant Task

Outputs a diff of the difference between two databases as a change log to bring them into sync.

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.
referencedatabaseref A reference to the reference database that Liquibase will connect to. Yes, unless a nested <referencedatabase> element is present.
difftypes A comma separated list of diff types to use. No
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.
driver Deprecated: Name of the database driver to connect with. No
url Deprecated: Use <database>'s url attribute instead. 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 to use by default for managed database objects and Liquibase control tables 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 No
databaseChangeLogLockTableName Deprecated: Overrides the name of the databasechangeloglock table to use No
referenceDriver Deprecated: The name of the database driver to connect with. No
referenceUrl Deprecated: The base database URL. No
referenceUsername Deprecated: The base database username to connect with. No
referencePassword Deprecated: The base database password. 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 ouputfile="/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.

referencedatabase

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

changelogparameters

Optional. See change log parameters

Examples

<liquibase:diffDatabaseToChangeLog>
    <liquibase:database driver="${db1.driver}" url="${db1.jdbc.url}" user="${db1.user}" password="${db1.password}"/>
    <liquibase:referenceDatabase driver="${db2.driver}" url="${db2.jdbc.url}" user="${db2.user}" password="${db2.password}"/>
    <liquibase:xml outputFile="/path/to/diff-changelog.xml" encoding="UTF-8"/>
</liquibase:diffDatabaseToChangeLog>

Generate a change log based on the difference between the two databases. Output the changelog to an XML file.

<liquibase:diffDatabaseToChangeLog>
    <liquibase:database driver="${db1.driver}" url="${db1.jdbc.url}" user="${db1.user}" password="${db1.password}"/>
    <liquibase:referenceDatabase driver="${db2.driver}" url="${db2.jdbc.url}" user="${db2.user}" password="${db2.password}"/>
    <liquibase:xml outputFile="/path/to/diff-changelog.xml" encoding="UTF-8"/>
    <liquibase:yaml outputFile="/path/to/diff-changelog.yaml" encoding="UTF-8"/>
</liquibase:diffDatabaseToChangeLog>

Generate change logs in both XML and YAML format.