Hello Lukas,
thanks for the nice explanations!
Im currently reading the book "jooq masterclass" by anghel leonard and its a great read.
jOOQ has so many features, and the two blog articles you linked here are also very interesting, i will try to make use of them.
I even searched for a jOOQ sticker online to put on my work laptop, but thats something still missing :)
---
what i like about liquibase:
---
1. Contexts
Liquibase allows changesets to be associated with context(s).
I need to be able to associate my changesets in two differents contexts: "ddl", "dml".
Because then i can provide following workflow:
- Execute all "ddl" changesets, but only mark "dml" changesets as executed (do not execute them).
This way i can always create an empty schema that does not contain data.
Please see my blog-post (its still a draft) about this topic:
---
2. Developers can work on different changesets at the same time (with Help of Tags, Rollbacks and free filenames)
Because in liquibase changeset-files can get free filenames ("featurexyz.xml") there are less conflicts.
- Peter can work on "featurexyz.xml" in his Git-Branch "featurexyz"
- Maria can work on "featureabc.xml" in her Git-Branch "featureabc"
Maria is going to Vacation for 1 Week. Now Peter can manually Rollback his "featurexyz.xml" because he gave the changeset contained in this XML-File
a specific Tag ("featurexyz"). He executes Liquibase Rollback manually (via a gradle task for example) and rollbacks this changeset locally (Rollback-Sqls are executed)
Now he checkout Marias Git-Branch, and starts his App. Now Marias Changeset "featureabc" is executed.
In other Migration-Tools like Flyway or Play-Evolutions the Filenames often need to have ascending order, like: "001.sql", "002.sql".
For the described use-case, Maria and Peter would have both worked on the File "002.sql", and this File would need to contain Rollback-Sql also.
When Maria merges her Branch into the Dev, and Peter merges the Dev into his Branch he will need to resolve a Git-Conflict first. He would need to rename his 002.sql
to 003.sql and override his 002.sql with Marias 002.sql.
---
What i dislike about Liquibase.
Liquibase has no option to execute all Changesets in one! Transaction.
Each Changeset is executed in a Transaction.
When one of the Changesets fail for any reason (maybe even during Live-Deploy) the Developer / Dev-Ops Person must fix this State where some changesets
have already been applied successfully, while the rest could not be applied because of an error.
If all changesets could be forced to be executed in One! Transaction (some Databases support this), it would be much safer.
The XML-Files are maintenance intensive because they are very "speaky". I need to provide multiple Identifiers for the changeset:
- Author
- Id
- Tag
- Context
- Ids need to be references sometimes again in the chageset..
Intellij does not show the <sql> in an XML-Changeset nicely, but mostly i would want to use plain SQL and not the Liquibase XML-Syntax (even though it is typesafe),
because it should be possible to always get the plain SQL of those changesets, because sometimes a release-deployer or dev-ops person should be able (in case of error)
to manually apply them safely to the database. Im not really sure if liquibase can also generate SQL out of the XML-Format, and if i should use this.
---
Play-Framework:
The Play-Evolutions during startup automatically detect, if the local Migration-Files are before/behind the applied migrations,
and if there is a discrepancy (diff).
When Play-Evolutions detects that there is a Diff at some evolution:
- It rollbacks all evolutions in backward ordering until it reaches this diff evolution and also rollbacks this.
- Afterwards it forward-migrates this evolution again and also all evolutions coming after this one.
This perfectly supports the typical Workflow of Developers, when they need to:
- switch branches
- work on different feature-branches that contain different new migrations (be able to fastly rollback and apply evolutions in different development branches)
Play-Evolutions has a very nice Local Developer Workflow going on, which mainly consists of a Small UI in the Webbrowser, that has an "Apply Evolutions" Button.
When there are errors, one could easily see the problematic code part in the browser and could manually fix his Db and afterwards click on the "Apply Evolutions" Button again,
to continue with his business without much interference.
--------------------------
It would be cool if jooq-migrations:
- would also be able to automatically! rollback changesets until the Diff (like play evolutions). Liquibase can not rollback automatically, only manually.
- has contexts like liquibase to put changesets into different categories.
- has unique changeset ids like liquibase that do not produce git conflicts (not like play-evolutions).
just some input :)
best regards,
Bernd