Entity Framework 4.3 Migrations move existing data

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

Answers


In migration Up method of your migration you can use Sql method to define any SQL you need so if you use explicit migration you can put data migration code between creating Table B and removing Table A.


Need Your Help

How to convert time object to minutes in python

python postgresql

I have an output from a database(postgreSQL) in python. The time is encoded as timestamptz. We need to be able to convert the time into just minutes.

Use of Spies for detecting method calls

ruby-on-rails ruby-on-rails-4 rspec rspec-rails

I'm new to RSpec. I'm using the following (correct) piece of spec code for making sure that the methods find and same_director are called in the tested controller: