Entity Framework 5 First Migration Steps for Production?

I am doing some research on EF5 and came across this question.
The applications made in the answer make sense to me.

But now, in EF5, we have Migrations. Therefore, let's say that I created an application with First code, and now it has been working and has been working for some time, and the user's confidential data is accumulated in the database. Consider the case when the model needs some changes.

Is it possible to simply update POCOS and let Migrations take care of updating the database, or are there any preparatory measures to prevent data loss?

(I would like to have someone here who had a working setup of Code First and Migrations in a real application)

+4
source share
2 answers

First, in production, make sure your DbMigrationsConfiguration sets AutomaticMigrationsEnabled = false . Then, after changing the model, run the Add-Migration command. This will create commands to modify your database, and you will see that something was deleted before it was executed. Thus, you are in full control of what is happening in your database.

+3
source

It is never absolutely safe to make any changes to the database, as you may have made errors in the migration code, or there may be a disk error that causes problems ... there are many potential problems, so you should make backups before performing the migration or any other database change.

0
source

All Articles