user5716425 user5716425 - 6 months ago 74
SQL Question

Invalid object name 'dbo.__MigrationHistory'

Everything went well until 2 days ago, I had inserted things in database before, but suddenly it gave me an error (don't remember it as it got fixed) but error after error I'm still stuck and can't insert a record in my DB.

The error I get now is: Invalid object name 'dbo.__MigrationHistory'.
I searched Google and found 3 relevant issues but the procedures didn't solved my issue...

I tried in nuget with the command to enable migration also.

I truly don't understand how this is appearing all of a sudden.
I didn't change anything except codelogic.

I updated to the new version of entity & VS update 2 couple days ago, idk maybe that is the cause...

Answer

you need to run following commands in package console managers:-

add-migration MigrationName

This will add new migration class to your project. Now run:-

update-database -verbose

This will fix your issue and will re-create "dbo.__MigrationHistory" table.

Comments