5

Closed

When working in a team environment the Migrations get out of sync

description

I was about to submit a lengthy explanation but after looking on the stackoverflow there was a much better description. See link below from JulianR stackoverflow post
http://stackoverflow.com/questions/13314725/migrations-in-entity-framework-in-a-collaborative-environment

Basically when working in a team using source control if multiple developers check in migrations and then try and run the Update-Database command they get a message like:

Unable to update database to match the current model because there are pending changes and automatic migration is disabled. Either write the pending model changes to a code-based migration or enable automatic migration. Set DbMigrationsConfiguration.AutomaticMigrationsEnabled to true to enable automatic migration. You can use the Add-Migration command to write the pending model changes to a code-based migration.

Even if I drop the database and rebuild again it will fail. The issue seems to be with the meta data which is out of sync which causes the issue above.

My workarounds are to delete the migration in the middle migration and then readd the migration so that the meta data follows in order which is a pain (especially if it was a complex / users altered migration)
Closed Sep 20, 2013 at 5:51 PM by RoMiller

comments