I am trying to understand how to implement the following deployment scenario using EF code and migration. The idea is that I would like to update the database with backward compatibility changes (for example: add a column) and check that it still works. It is inspired by the introduction of green / blue, but does not fully match this pattern. The rationale for this is the following process:
- Database Update (EF Migration)
- Test Website
- Update Website Code
- If something goes wrong, return to the previous site code
The problem that I will certainly encounter is that in step 2 (and 4) I will definitely get an error from EF about changing the model, although all database changes are compatible with the existing code ...
I know that the solution would be to transfer the Down database to the previous version (or even make a backup copy of the database), but it may happen that some migrations are really complicated, and the Down part may be broken or just poorly encoded.
So my question is: is there a way to avoid EF model validation or, in the end, to know that the changes are backwards compatible?
source share