1

I have inherited an entity framework application that i have been tasked to create within a separate environment with a completely separated database as well on a new db server. Seems easy enough. I backup the database from the original and restore it on the new database server. the data is the exact same at this point.

For testing purposes i change the local connection string to the new database server and run my web app locally. I get an error in the browser that is "MySql.Data.MySqlClient.MySqlException: Can't write; duplicate key in table '#sql-3b87_2d5f91'" i dont even have a table with that name and have no idea where it comes from. entity framework also creates duplicate tables for all of my tables except for migrations table.

I have tried other things as well, after restoring the db in the new db server to the original again, i have tried running 'update-database' and the same issues happen.

Now if i disregard restoring the new database with the backup from the original and run "update-database" on the new database server. it creates the schema correctly, but it lacks the data i need for testing.

Any ideas why this may be happening? i would like to avoid writing a sql script to transfer data.

Sean Wagner
  • 121
  • 1
  • 2
  • 9
  • It seems when you're inserting the exported data the indexes aren't being updated, you need to reseed them: http://stackoverflow.com/questions/510121/reset-autoincrement-in-sql-server-after-delete – Gusman Feb 26 '16 at 16:05

0 Answers0