I accidentently deleted records in __MigrationHistory. I got the following error message when trying to Add-Migration
for model changes.
Unable to generate an explicit migration because the following explicit migrations are pending: [201303101108238_InitialCreate, 201304020555457_xxx, 201305070251407_xxx, 201306090833462_xxx, 201306140437274_xxxx]. Apply the pending explicit migrations before attempting to generate a new explicit migration.
It will get the following error if running Update-Database
.
There is already an object named 'TableName' in the database.
What I can do to make it work?
The __MigrationHistory table contains all the information for Entity Framework to determine which migrations are done. Based on the current list of migrations in your code it will apply the missing migrations.
If you have deleted this table without the database part you have a few options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With