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
Yet migrations history table can be reused by multiple contexts. (At least I could not find the warning in the documentation that each context should have its own history table.)
Alternatively, I'd propose that each migration withing the same history contains some fixed id, so it's easy to understand which context it belongs to.
IHistoryRepository is a low-level service, so it's by-design that it returns rows for all contexts. But we should filter them in Database.GetAppliedMigrationsAsync and Database.GetPendingMigrationsAsync
Repo to reporduce: https://github.com/voroninp/EfMultipleContextsSameHistoryTable
When working with migrations, active database context should provide a list of migrations defined in code, and this list should be the baseline.
By default the call to
GetAppliedMigrations
should return only the migrations which belong to the active context.Currently, HisroryRepository just returns the list of migrations from history table.
Yet migrations history table can be reused by multiple contexts. (At least I could not find the warning in the documentation that each context should have its own history table.)
Alternatively, I'd propose that each migration withing the same history contains some fixed id, so it's easy to understand which context it belongs to.
and
This
HisotoryId
should be the column in__EFMigrationsHistory
table.The text was updated successfully, but these errors were encountered: