Skip to content

Liquibase and JOOQ

Slin Lee edited this page Feb 19, 2020 · 6 revisions

Important Notices

  • IMPORTANT: Please note that these are the steps I take to make everything consistently work even though it should not all be required. Once the related issues are resolved we need to update this wiki page.
  • IMPORTANT: At this time all JOOQ generated code is suppose to be committed into the repository.
  • TIP: If you run liquibase:update then I recommend running liquibase:dropAll just before starting your web server otherwise it can sometimes cause errors.

Liquibase

  • IMPORTANT: The server should be SHUTDOWN while you perform these steps.

Simple Update

  • liquibase:update

If you are just doing a simple update with the latest changelogs then you can run liquibase:update in Maven and your database should be updated.

Debugging

  • liquibase:releaseLocks (if your DB is locked. This happens if the JVM is shutdown during an update)
  • liquibase:dropAll
  • liquibase:clearCheckSums
  • liquibase:update

If you are debugging and need to reset everything then it can get more complicated. In this case you need to run the above three Maven commands in order every time. The first liquibase:dropAll is to delete the contents of the database. Then you need to use liquibase:clearCheckSums so that there are no conflicts with the changeset id number. This step is very important because if you are debugging then you will most likely be using the same changeset id as you debug. And lastly you need to update the database with liquibase:update

JOOQ

  • IMPORTANT: You need to have the database up and running for this to work. Meaning that liquibase:update must have been the last command you ran.

  • jooq-codegen:generate

Running this will generate the code needed by JOOQ for the database.

  • TIP: You need to have the database up and running for this to work. Meaning that liquibase:update must be run just before you run jooq-codegen:generate.
  • TIP: In some cases for whatever reason JOOQ will run but doesn't seem to update anything. It's almost like it's cashing something. In those cases the first thing to try is to clean the project. This works most of the time but if that fails then the next step is to both clean the project and do a full clean of the Liquibase database, that is run liquibase:dropAll, liquibase:clearCheckSums, and then liquibase:updatealong with a maven project clean.

Clone this wiki locally