Be Careful When Removing an EF Core Property!

preview_player
Показать описание

This video continues the discussion of how to apply Entity Framework migrations without causing any downtime in production, this time showing how to remove a property from the domain model, along with the corresponding column in the database.
The key to zero downtime updates is to change the database schema in such a way that it becomes more general than it was, so that both the old and the new application can still work with the same database schema.
In this video, we are demonstrating how to make the column obsolete by turning it nullable in the model and ignoring it in the new application. We are then creating a migration that updates the database and makes the column nullable.
This process allows the existing, old version of the application to keep running while the new version of the application is deployed.

Learn more from video courses:

Other videos on this channel you may be interested in watching:

#entityframeworkcore #entityframework #dotnet
Рекомендации по теме
Комментарии
Автор

Thank you for the video! What do you think about introducing a shadow property just after you deleted the property from the model? This way you wouldn't need to modify the migration code manually.

michahelt
Автор

Very nice video, thanks. I just have doubts that it is easy as it looks like, In real life apps models complexity depends on domain you are modeling. Slow migration will last sometimes a year and tracking that through time very depressing. But this is the way :)

slobodanmikaric
Автор

Now let's say the old app was using year column - for example, to calculate an average age. The migration makes column nullable, a new user is added via new app version, and that breaks old app version. So much for zero downtime.

mihcom