1

I have been made a few changes to my database locally and have been adding migrations and updating the database via the Package Manager Console.

Now I've checked in and deployed out to the dev server however I am getting the error:

The model backing the 'MyProjectContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

I know this is telling me that my version of the database is out of date however I don't want to drop the database this time so im trying to generate a script to manually run on the database however I don't fully understand how I can tell it which is the last migration that the dev db is aware of and which is the current, up to date one, ive tried the below however its not working:

enter image description here

So If "Added IsImportant to exceptions" was the last migration updated on the dev server, and "Set ImportantId as Identity Specification" was the last update I manually run locally, how do I generate the right script for dev?

1 Answer 1

3

Turns out I was doing it right but needed the full configuration name with double quotes.

Update-Database -Script -SourceMigration:"201507091527309_Added IsImportant to exception" -TargetMigration:"201507281410132_Set ImportantId as Identity Specification"

Once I ran this it generated the script and I was able to upgrade the database.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.