EF Core lock the database during migration

偶尔善良 提交于 2019-12-10 20:57:49

问题


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:


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



来源:https://stackoverflow.com/questions/52439771/ef-core-lock-the-database-during-migration

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!