The bottom line is this: it was (and still exist) table workere (without right to logon to the server) and a few tables with users (managers and other management staff) and their roles that are created using ASP Net Identity. On worker tied several tables.
Now you need to transfer workerb to the table with users.
Use the EF Migration, with the help of automatically generated code for the migration, and in the middle of that code (after you created/updated the table and deleted table workername and others) are trying to make, in fact, the migration of data. I.e. (simplistically) something like this:
public override void Up()
//Here is some code that updates the DB structure
using (var db = new PCB())
const string getWorkersCommand = "Select * from workers";
var workers = db.Database.SqlQuery<worker>(getWorkersCommand);
var userManager = new ApplicationUserManager(new UserStore<user>(db));
var roleManager = new ApplicationRoleManager(new RoleStore<role>(db));
foreach (var worker in workers)
var newWorker = new User()
var result = userManager.Create(newWorker);
// Then for each created worker-living connection in linked tables
//Here is some code that updates the DB structure</role></user></worker>
Actually, this doesn't work (which is expected), throws exception:
The basic model of context "CwDb" has changed since the database was created. Consider a database update by using Code First Migrations (go.microsoft.com/fwlink/?LinkId=238269).
Sort of like the migrations has a special method, Sql(), but it does not return anything that could produce what I wrote above. Maybe I would write something in SQL and just do it via Sql(), but how users are generated in Asp.Net Identity is not clear, in particular Id, Legit Stamp.
In General, the question - how to do a proper data migration described in the case? I will be disappointed.