Is it possible lock the database from any other connections when running the migrations through
We have multiple service instances running the same code (on AWS Lambda), and do the migrations on startup. Now we have to manually make sure that only one instance is running when we want to apply some migrations, otherwise they can both try to do it and break things bad.
Is there a database level solution to this?
Not really sure if this is what you are looking for, but if you are willing to add plain
SQL to your migration you could set database to single user mode: Read more