I have accidentally deleted data from __MigrationHistory table and I tried to make migration new tables and column changes to db. At this time EF6 show me an error
"There is already an object named 'xxxx' in the database.".
I tried the way by using this command and there is no effect on table column changes.
Add-Migration MyMigration1 -IgnoreChanges Update-database -Force
There are many recommendation about this for recreating db or another else. But those ways might be effect data losing to my db which contains a huge size of tested data and I can't able to lost any data. How to solve this error by without losing any data. If anybody please...
Finally I found the solution to solve my problem. I am not sure it's a prefer way to solve such kind of problems but it's worked for me.
I cleaned data from __MigrationHistory table,tried to migrate new db and I copied data from __MigrationHistory of new db to my old db, then I set AutomaticMigration true and run update-database command and the problem was solved.
I'm not sure if its good approach to fix that but it worked for me.
I just did insert into that table with proper version and names of the already applied migrations, I did it in EF Core and it works actually, but please wait for somebody to comfirm that what im writing about.
The problem I see there is that you need two more fields to be filled (in EF Core theres only two columns) but I think that you can receive them using for example SQL Profiler