I attempted to migrate new tables and make column modifications to the database after I unintentionally erased data from the __MigrationHistory table. EF6 is now displaying an error to me.
"There is already an object named 'xxxx' in the database.".
I tried using this command to alter the table columns, but it had no impact.
Add-Migration MyMigration1 -IgnoreChanges Update-database -Force
There are several suggestions for replicating a database or anything else. However, such methods could result in data loss in my database, which has a large amount of tested data and I am unable to lose any data. how to fix the issue without erasing any data. Please, if anybody...
Finally I found the solution to solve my problem. I'm not sure whether that's the best approach to handle these kinds of issues, but it has for me.
When I attempted to migrate a new database and transferred data from the new database's __MigrationHistory to my old database, the issue was fixed. I then set AutomaticMigration true and ran the update-database command.