user3953989
user3953989

Reputation: 1929

Is it possible to generate changelog diffs?

I've got my baseline snapshot created using the generateChangeLog command. I've made some changes and I'm trying to figure out how to generate a changeset file by doing some sort of diff but it seems like that isn't a concept in Liquibase and those need to be created manually. XML also appears to be the preferred format but are we expected to hand-write xml files? Seems like this could be automated easily?

Upvotes: 0

Views: 1610

Answers (1)

tabbyfoo
tabbyfoo

Reputation: 440

You can run the diff-changelog command. Here's the relevant copy from the documentation.

Running the diff-changelog command requires two URLs:

  • referenceURL – the source for the comparison. The referenceURL attribute represents your source (reference) database which is the starting point and the basis for the database you want to compare.

  • url – the target of the comparison. The URL attribute stands for your target database which you want to compare to the source (reference) database. You typically perform actions and run the commands against this database.

To create a diff changelog:

The first option is to run the diff-changelog command and pass the attributes needed for your source (reference) database and target database.

As an example, you can run the following:

liquibase
--changelog-file=dbchangelog.xml
--url="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
--username=<USERNAME>
--password=<PASSWORD>
--referenceUrl="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
--referenceUsername=<USERNAME>
--referencePassword=<PASSWORD>              
diff-changelog

Reference:

  1. Running the diff-changelog command

Upvotes: 1

Related Questions