A repeatable gate that stops a release when the target database is not what the release expects
Most database pipelines verify the change: the migration compiles, the tests pass, the reviewer approves. Far fewer verify the target. Yet a correct migration can still fail if the database it lands on has drifted from the state the release was built against.
This post walks through a practical drift check you can run before every SQL Server deployment. You define a reference schema, compare it against your environments, classify what you find, and turn the result into something a person reviews instead of an automatic sync.
The failure mode
Drift breaks releases in two directions.
Something is missing from production. A developer adds a column directly to a staging table while building a feature. The application code starts reading that column, every test in staging passes, and the change never makes it into the release migration.β¦