Entity Framework 4.3 Migrations Move Existing Data

I am using EF Code First 4.3 Migrations to update my database schema. Now I have the following situation: table A needs to be deleted, table B needs to be created, and table A data must be copied (along with some other data) to table B. I do not have access to DbContext in the DbMigration class, my question is How to implement this?

+6
source share
1 answer

In the Up migration method, you can use the Sql method to determine any SQL that you need, so if you use explicit migration, you can put the data transfer code between creating table B and deleting table A.

+13
source

Source: https://habr.com/ru/post/917947/


All Articles