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
{{ message }}
Repository navigation
Merging migrations by manual causes incorrect migration.Designer.cs metadata #3835
Entity framework core seems to be really better suited for working on migrations in team environment than previous versions were. But merging migrations which were created in different branches (like mentioned in this manual https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/teams) will cause the last created migration's .Designer.cs metadata to be not correct (as it will contain snapshot, which won't include first merged migration's changes). As I understand, migration.Designer.cs snapshot is used when we call 'dotnet ef migrations remove' to restore previous version of ContextSnapshot, but in case with merged migrations restored snapshot will be wrong.
Are there any further developing plans to prevent this situations to happen? Like for example don't store snapshots in migration.Designer.cs and when we call 'dotnet ef migrations remove' to try to calculate previous version of ContextSnapshot by somehow using migration's down method code and not by using migrations .Designer.cs metadata?
Reacted by Brice Lambson, Giorgi Chakhidze, Jason Gallavin, Blaisor and jamespAWH
This a major issue for my team. We have internal documentation that instructs us to ignore the Microsoft documentation since it is incomplete. Our documentation states that when doing a merge of latest changes into your feature branch you should remove your migration(s). merge, re-add your migration. This is a slow process though and has caused a lot of additional work when merging pull requests. I have to merge a pull request, then instruct the next pull request owner to pull in the changes and regenerate their migration. Rinse and repeat. After the team grows to a considerable size, this will no longer be an option as merges have to be coordinated with a lot of involvement of each developer.
Activity
jasekiw commentedon Mar 16, 2023
This a major issue for my team. We have internal documentation that instructs us to ignore the Microsoft documentation since it is incomplete. Our documentation states that when doing a merge of latest changes into your feature branch you should remove your migration(s). merge, re-add your migration. This is a slow process though and has caused a lot of additional work when merging pull requests. I have to merge a pull request, then instruct the next pull request owner to pull in the changes and regenerate their migration. Rinse and repeat. After the team grows to a considerable size, this will no longer be an option as merges have to be coordinated with a lot of involvement of each developer.
Expand and clarify migrations guidance. (dotnet#5445)