0

I have a requirement like calling a .bat file with parameters from liquibase upgrade scripts. Also also this should run only one time like change set.

Thanks, Jags

Jagadeesh
  • 1,630
  • 8
  • 24
  • 35

1 Answers1

0

You would want to look at the executeCommand change type, documented on the liquibase site.

Here's a quick example:

<changeSet author="liquibase-docs" id="executeCommand-example">
    <executeCommand executable="runCommand.bat"/>
</changeSet>

As with all changesets, by default this would run only once per database. If you wanted something to run with each update, you could add the runAlways or runOnChange attributes to the changeset.

SteveDonie
  • 8,700
  • 3
  • 43
  • 43
  • Thank You Steve.I am relative path with parameters(..\..\mybatchfile.bat ${DBServerFullName} ${DBName}) but getting returned an code of 1. – Jagadeesh Feb 07 '19 at 07:41
  • That is unfortunate. Do you know why it is returning 1? Can you get the output from the command? Running liquibase with `--logLevel=debug` might help with those. – SteveDonie Feb 07 '19 at 18:02
  • Hi Steve, We are running the liquibase scripts using TeamCity. – Jagadeesh Feb 26 '19 at 13:19
  • So you've added one more layer of complexity, and will need to dig into that. Each layer of commands might need to be investigated. Add echo statements to your batch files, etc. etc. until you find out the reason for the return code. Until then, you can't really do anything but guess. – SteveDonie Feb 27 '19 at 14:25