EF Core lock the database during migration

.net-core ef-core-2.1 entity-framework-core

Question

Is it possible lock the database from any other connections when running the migrations through Database.Migrate()?

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?

ef-core 2.1

1
3
9/21/2018 8:44:34 AM

Popular Answer

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

0
9/21/2018 9:16:24 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow