entity framework - EF6 Code First update-database without deleting data -
I am trying to update my DB with changes made in my unit model (some extra table columns) . But I do not want to leave & amp; Rebuild the database because it will delete all my test data. Before this I have done this and have used the seed method to make some basic data, but now I have a lot of data that I keep.
I have tried to run the updated database but I get the error:
There is already activity 'named' activity in the database. By viewing the migration script, I can see that he is trying to create a table activity notit line. Obviously I do not want to do this I do not mind using the initial migration again
add-migration initial creation " , But now when I run an update-database, then he thinks there is no change!
I am sure that whatever I want to do is possible, but I can not seem to do this work. If I have to leave & amp; Rebuild the DB, but I would like to know if any one will successfully update and keep the data.
The issue is to create all tables to create scripts in the migration folders. When the update is running, to see if the migration scripts are already running, the table appears on dbo.MigrationHistory in your database is not created in the table, so the update is trying to run it.
You can manually add logs to the table or edit the script or erase the above content and methods below, when you run the update, this script will run, which is nothing , And migration will write the entry in the table.
Comments
Post a Comment