I have an EF 6.13 + MVC 5
website running on Azure and I am trying to use Azure's Deployment Slots which is basically having always 2 (or maybe more) sites running while using the same DB and different versions of the source-code, think of it as Slot1 has current production code and Slot2 has the vNext code.
The issue I'm having is that when there's a migration in Slot2, even if we make it so that compatibility is not affected, then EF will complain about the DB not being in the same version as the Model.
I have read this questions:
- EF backward compatible DB migrations
- How can I disable model compatibility checking in Entity Framework 4.3?
but in both cases they ensure EF won't complain about Model compatibility by making it NOT CHECK compatibility at all using some variation of this:
public class MyDBContext: DbContext
{
public MyDBContext() : base("myConnString")
{
//Disable initializer
Database.SetInitializer<MyDBContext>(null);
}
}
There is however a few things unclear to me:
If I change the Model Compatibility checks and no migrations are run automatically, then how do I migrate my DB?
Can I make my
DbContext
check model compatibility and warn me only if it's broken (like I deleted a column or something like that, not that I added another column, I know this can be troublesome but bear with me and assume I have a plan for these kind of events)