So I have this debian package that install some nodejs application web app which uses a mysql database. The package have a postinst script that run the db migrate command bundled with he package.
Now, I want to shard the application into multiple server (2 frontend and 1 database backend). The problem I am facing is that both frontend servers are going to try to update the schema at the same when deploying the new packages. This does not seems right to me.
Also, it kind of create a dependency between the package and a running mysql server. This does not seems right to me either.
What are the good ways of acheiving automatic database schema upgrade when a new package requires it ?