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
Commit f5a2f4d
Browse filesBrowse the repository at this point in the historyBrowse files
✨ feat(evolution): answer for drift against the database the model runs on
Entity Framework cannot answer this for itself. Its history table records which
migrations ran; has-pending-model-changes compares the model to the migrations.
Neither looks at the schema, so neither reports a column altered by hand on staging, a
migration that stopped halfway, or an environment restored from a backup older than
the last release. Only looking answers those.
AddDriftCheck<TContext>() registers an IDatabaseSnapshotSource over the context. It
describes what the model says the tables should be — straight from EF's own metadata,
GetColumnType() included — and what the database actually has, read from the
catalogue. Both sides land in the provider's own store-type vocabulary, which is the
whole reason a healthy schema compares silently: EF resolves character varying(50) and
PostgreSQL reports character varying(50).
PostgreSQL, MySQL and SQL Server are covered. Any other provider says it cannot answer
rather than answering wrongly.
Generating migrations is deliberately not here. Entity Framework already does that,
from the same model, and better than a second generator could; adding a worse one
beside it would be a disservice. What this adds is the part it leaves out.
Depends on eQuantic.Core.Data.Abstractions 6.9.0, which moved DriftComparer and
DriftReport into the contracts — before that, a provider could describe both sides of a
check without the engine and still not compare them.
Verified against a real PostgreSQL through a new Testcontainers suite, the repository's
first: a schema Entity Framework itself created reports nothing, and a column dropped,
narrowed, or made optional by hand, a dropped table, and a column nobody mapped are each
found by changing the database out from under the model. 47 tests across the five
suites; the new one is in the CI matrix.
0 commit comments