I'm trying to figure out how to implement the following deployment scenario using EF code-first and migrations. The idea is that I would like to upgrade the DB with backward compatible schema changes (e.g.: add a column) and test that everything still works. It is inspired by green/blue deployment but it's not entirely following that pattern. The reasoning behind this is in following this process:
- Upgrade database (EF migration)
- Test website
- Update website code
- If something goes wrong, revert to the previous website code
The problem I will certainly face is that at step 2 (and 4) I will surely get an error from EF about the Model being changed, although all the DB changes are compatible with the existing code...
I know that a solution would be to migrate "Down" the database to the previous version (or even do a DB backup), but it may happen that some migrations are really complex and the "Down" part may be broken or simply poorly coded.
So my question is: is there a way to avoid EF checking the Model or eventually be aware that the changes are backward compatible?