Update of database schema

Looking at the documentation for the 7.10 release, it seems there is no other way to upgrade the schema of the database automatically, other than executing all of the SQL scripts, am I correct? Even with the DB_SCHEMA_UPDATE_TRUE option, it looks like only the initial creation of the schema is performed by the engine on build, but not any of the updates (either patch or minor release versions).

Is there no other option than building your own mechanism to automatically update the db schema to the version matching that of the library? This would be a real nuisance with many process engines in different microservices.

I’m sure somebody knows the answer to this! :grinning:

Hi @tiesebarrell,

That is correct.

I think some people use Liquibase for that, but I am not aware of anything that is publicly available. Would certainly make for a nice community extension, though.

Cheers,
Thorben

Hi @thorben

thanks for confirming that. Liquibase or something else might prove an option indeed, especially if the upgrade needs to be rolled out to a number of engines. That would make it worth it to automate.

Cheers,
Tiese

Were you able to achieve this using liquibase?

Hi @Mass_Shake, yes, we created an automated upgrade mechanism with Liquibase that’s run in an init container on Kubernetes.

Ok…Thanks…

If you’re interested in more details, let me know.

Could you please share a bit more details of your liquibase solution? I’m facing the same problem

We use an init container in Kubernetes for each pod that requires a Camunda schema.

That init container contains the liquibase runner and a bunch of the SQL files that Camunda requires, plus of course, the liquibase descriptor that ensures the correct SQL files are run in the right order.

In the meantime, Camunda has started publishing liquibase descriptors for any Camunda versions > 7.16 IIRC. So you could also base off of that. Back when we started, we basically handcrafted the same files.

In order to share the setup between components, we made sure that our shared library contained all of the descriptors and SQL files, and that upgrading to a newer version of the shared library also gave you the correct matching setup for liquibase. That part was a combination of Maven dependency management and copying resources into the docker working directory when building the init container. This is obviously only needed for re-use and quite custom to your setup with Maven and how you use Docker. The general idea would be the same with slightly different setup: build a container that matches the version of Camunda in the main container and package all the scripts into it and run them in order with liquibase before you start the main container.