Note that there are some explanatory texts on larger screens.

plurals
  1. POEF Code First Migrations Developer Conflicts
    text
    copied!<p>We are running into some conflicts when using EF Migrations with 2 or more developers. I'm curious if anyone has a better solution than what we ended up with to resolve these issues. First, here is the scenario:</p> <p>2 Developers, Dev1 and Dev2:</p> <p><strong>The problem:</strong></p> <ol> <li>Dev1 and Dev2 both make model changes simultaneously in their working copies of the application. </li> <li>Dev1 and Dev2 both create a migration (add-migration) and update their local database so they can test (update-database). </li> <li>Dev1 finishes and checks his code in first. </li> <li>Dev2 checks out the code from Dev1 and runs update-database.</li> <li>Dev2 gets an error, saying there are outstanding changes. These "outstanding" changes are the changes that were previously applied in his own migration but are now unaccounted for after applying Dev1's migration, even though the changes actually have already been applied. It seems that the model validation is confused, thinking those changes were never applied as a result of applying Dev1's migration.</li> </ol> <p><strong>Our solution:</strong> Dev2 creates a new migration and empties out the Up() and Down() methods, then runs update-database. This gets everything back in sync again.</p> <p>This solution works, however it results in many empty migrations that have no purpose except to get the model hashes back in sync. Has anyone had similar issues and found another way around them? Or are we using the database migrations incorrectly?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload