Suppose you have an existing Entity Framework database in production and you’ve made changes to the model in your C# project. Of course you have messed up / lost your migrations files. What to do?
– delete the _MigrationHistory table from the database
– delete the Migrations folder from you solution (you might want to keep a backup of the Configurations.cs file is you’ve made changes to that e.g. Seed)
– in the package manager console type:
- add-migration initialcreate -ignorechanges
Your all set!