Skip to content

Instantly share code, notes, and snippets.

@tyagiakhilesh
Last active July 6, 2022 16:29
Show Gist options
  • Save tyagiakhilesh/a53c826089faf17068f57eb16922eb6e to your computer and use it in GitHub Desktop.
Save tyagiakhilesh/a53c826089faf17068f57eb16922eb6e to your computer and use it in GitHub Desktop.
Running liquibase to do various tasks like generate changelog and what not.
  • Download liquibase archive file
  • Extract it
  • Create liquibase.properties file like below and put it in LIQUIBASE_HOME
driver=com.mysql.cj.jdbc.Driver
url=jdbc:mysql://localhost:3320/test
username=<user>
password=<pass>
changeLogFile=changelog-test.xml
classpath=/tmp/lb/mysql-connector-java-8.0.18.jar
# Have this here if you want to have changelog generated for data as well
diffTypes=data 
  • Run commands like this, from LIQUIBASE_HOME ./liquibase generateChangeLog

  • To apply changelog ./liquibase update

################

Some hand commands. At times, because of certain reasons, you might face checksum change errors. https://stackoverflow.com/questions/9995747/liquibase-checksum-validation-error-without-any-changes (something like this).

In this case clearCheckSums the liquibase command to go for.

At times, you actually want to ignore certain changelogs - because some fool - did make changes to db outside the version control and now you don't have preconditions to apply the change - another mistake that fool that! (or vice versa). Then to temporarily unblock yourself, you can use markNextChangeSetRan command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment