I have an ASP.NET MVC3 project that uses Entity Framework 4.3 with the code-first approach. I use Migrations to keep the database up-to-date.
The project is under so
Rowan Miller has made a great video about this topic on channel 9: Migrations - Team Environments. It refers to entity framework 6.
It describes a scenario where first developer A and B are working on the same model and A checks in first. Now developer B has to deal with the problems he has when he gets the latest version from A.
This is essentially the same like having conflicts between different branches, because the general problem is merging migration changes done it the same time but effectively having a different source state of the model.
The solution is:
UpdateDatabase command of developer B would still fail at this time (Error message: "Unable to update database to match the current model because there are pending changes...")IgnoreChanges option:Add-Migration NameOfMigration -IgnoreChanges
Then the UpdateDatabase command will succeed.
Source of the problem
The source of the error occurring when updating the database is because EF stores a snapshot of the model a migration refers to in the resx file within the migration file.
In this case developers B snapshot of the "current model" is not correct after getting / merging the changes made by developer A.