You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently working on a project where multiple developers are adding migrations into source control at the same time using EF6 CF. Both of the developers will make a change to their migrations, but when the second one merges in the code from the first, their migrations don't contain the correct snapshot, causing the Update-Database to fail due to pending migrations (although they are covered by the merged-in migrations).
I wasn't sure if there was currently a way to fix this issue other than to create an empty migration to get a valid snapshot of the state of the system.
If there is not, I propose that a command is added that allows a developer to force-update the history tracking on the latest migration so that the Update-Database command will be better able to determine if there are really pending changes or not.
Note that this would also be a problem if you were to copy/paste a migration into your migrations folder -- so it's not necessary limited to developer teams.
The text was updated successfully, but these errors were encountered:
This is one of the pitfalls of using Code First Migrations in team environments. The Code First Migrations in Team Environments article will walk you through the steps needed to resolve issues like this. Have at least one person on your team get familiar with it. 😉
Don't hesitate to ask if you have any specific questions on how to apply the article to your scenario.
Also, we feel your pain. This is one area that we've worked hard to improve in EF Core. We've introduced a common model snapshot file that will make merging migrations a lot easier.
I'm currently working on a project where multiple developers are adding migrations into source control at the same time using EF6 CF. Both of the developers will make a change to their migrations, but when the second one merges in the code from the first, their migrations don't contain the correct snapshot, causing the Update-Database to fail due to pending migrations (although they are covered by the merged-in migrations).
Examples:
http://stackoverflow.com/questions/19136066/why-does-add-migration-sometimes-create-duplicate-migrations
http://stackoverflow.com/questions/17921886/update-database-fails-due-to-pending-changes-but-add-migration-creates-a-duplic
I wasn't sure if there was currently a way to fix this issue other than to create an empty migration to get a valid snapshot of the state of the system.
If there is not, I propose that a command is added that allows a developer to force-update the history tracking on the latest migration so that the Update-Database command will be better able to determine if there are really pending changes or not.
Note that this would also be a problem if you were to copy/paste a migration into your migrations folder -- so it's not necessary limited to developer teams.
The text was updated successfully, but these errors were encountered: