Click here to Skip to main content
15,911,030 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
So i loaded up an old project to fix a bug.

The project tries to run the initialiser, but upon doing so complains that there are pending database changes, or the model is incorrect etc.

So my questions are:

1) Why is it requesting another migration to be addded to run succesffuly, when the site has gone live and already works fine?

2) Why is it scaffolding a migration that already exists?

What I have tried:

Add-Migration in the console, and it scaffolds the migration. However the newly scaffolded migration is exactly the same as the pre-existing "Intial_Create" migration (this is the 1 and only migration).
Posted
Updated 23-Nov-16 6:41am

1 solution

Plz first take backup of your project. Then follow these steps.

Go to the project (if multiple projects) Which have EF context class. Delete the [Migration] folder.

Then go in Nuget Package Manager Console.

And in dropdown select the project (if multiple projects). And then run following commands to get things OK for EF.

Enable-Migrations


This will generate again the migration folder

Then again fire command in Nuget Con...

Add-Migration 'with any message'


This will push things if any pending changes there

then again fire last command

Update-Database


Now ur Ef is OK back again
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900