1

My company is using jenkins job to run liquibase on oracle database. We want to keep track of git branch from which changesets are executed. Is there a way to add column to DATABASECHANGELOG where I can store git branch from which the jenkins liquibase job is executed?

harv3
  • 263
  • 1
  • 6
  • 19

1 Answers1

1

I don't think you can add columns to databasechangelog table.

But I guess, when you write a changeSet, you know in what branch it's going to be executed. So you can provide a branch name in changeSet's id or inside a <comment> tag. This way, branch name will appear in databasechangelog.id and databasechangelog.comments

htshame
  • 6,599
  • 5
  • 36
  • 56
  • It is possible to do that but we need to change comment tag every time when the job is executed from another branch and later merged into master. – harv3 Sep 17 '19 at 13:02
  • Maybe I'm missing something, but shouldn't `changeSets` be executed only once? – htshame Sep 17 '19 at 13:04
  • Basically for testing purposes we execute it in one environment and later merge the branch into master and remove it and execute in another environments. So we will be required to change branch name to master. – harv3 Sep 17 '19 at 13:20
  • Perhaps, you can use properties in changeSets with some git-plugin, that'll provide you with the name of git branch. Check out this question. https://stackoverflow.com/questions/20610948/how-can-i-populate-liquibase-parameter-values-from-an-external-properties-file – htshame Sep 17 '19 at 13:40