Photo by Towfiqu barbhuiya on Unsplash
SQLcl Liquibase - generate-schema enhanced. Capture only new changes since provided date.
SQLcl Liquibase generate-schema command is excellent (read more here)
But what If I don't want to capture all my objects repeatedly?
I want to capture, e.g. every week, all the objects that have changed since the previous run.
So I'm missing something like:
"liquibase generate-schema changesSince 2023-07-01"
Hopefully, Oracle will add this feature soon.
But meanwhile, I created a workaround SQL script for that.
Details:
It takes objects that changed in the last few days
Then dbms_output a script for SQLcl Liquibase.
You should create a temp folder, e.g. changesSince, go there, log into SQLcl and execute received dbms_output
It executes "liquibase generate-object --object-type TYPE --object-name NAME" as many times as many objects change (this command generates only one object per one execution, instead of all objects)
If there are new objects, remember to add new lines to controller.xml - you can use ChatGPT to help you with that :)
Feel free to use it or make it better. But don't just copy/paste and run. Try to understand this script, as you are using it at your own risk :)