0

I am working on Liquibase commands for database schema versioning. Currently I am working with diffChangeLog command. Below is the sample format which I am working on it.

liquibase
--changeLogFile=dbchangelog.xml
--outputFile=mydiff.txt
--driver=oracle.jdbc.OracleDriver
--classpath=ojdbc14.jar
--url="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
--username=<USERNAME>
--password=<PASSWORD>
diffChangeLog
--referenceUrl="jdbc:oracle:thin:@<IP OR HOSTNAME>:<PORT>:<SERVICE NAME OR SID>"
--referenceUsername=<USERNAME>
--referencePassword=<PASSWORD>

As per my requirement, I don't want result of this will get saved on dbchangelog.xml. I want to get this result on console only. Is it mandatory to pass changeLogFile parameter because if I don't pass then diffChangeLog command is not working. Please help.

Rohan
  • 29
  • 1
  • 3

1 Answers1

0

Unfortunately, it is basically inherent in the command to alter the changelog file.

As a workaround, you could do this with a wrapper script.

  1. run diffchangelog
  2. use your source control to show a diff of the changelog file
  3. use source control to revert the changes

If you don't have source control (please tell me you are using source control) then you could accomplish the same thing with just the file system:

  1. make a backup copy of the changelog file
  2. run diffchangelog
  3. use a command-line diff to compare the altered changelog file to the backup copy
  4. restore the backup copy of the changelog file
SteveDonie
  • 8,700
  • 3
  • 43
  • 43
  • Thanks Steve for the respose. Could you please explain me how to compare two different changelog files? – Rohan Feb 21 '20 at 03:21
  • There are many different tools available for this. If you are on Linux, there is the built-in `diff` command. On Windows, I use a tool called Beyond Compare, but there are many many tools in this category. Changelog files are just plain text files (formatted in XML or other formats, but still just plain text) so easily compared with standard tools. Another of my favorite tools is the compare tool included with Tortoise SVN and Tortoise Git. – SteveDonie Feb 21 '20 at 16:50