Merged upstreamCorrectnessMerged Jun 18, 2026
Report rolled-back migrations as unapplied
Fixed Prisma schema-engine migration diagnostics so migrations resolved as rolled back are reported as unapplied instead of making migrate status look clean.
prisma/prisma-engines · #5817
Problem
diagnoseMigrationHistory matched filesystem migrations with any migration-table row that shared the same name, including rows marked rolled_back_at. A migration that failed, was manually resolved as rolled back, and still existed on disk could make prisma migrate status report no pending migration.
Approach
Filtered rolled-back database migrations out of filesystem-to-database correlation in both schema-engine diagnostic paths, then added a regression covering a rolled-back migration that must be reported as unapplied.
Impact and scope
- Makes prisma migrate status safer as a deployment pre-flight check by detecting rolled-back migrations that still need to be applied.
- Prevents a false clean status after manual rollback resolution, reducing migration drift and rollout risk.
- Keeps schema-engine and CLI migration-history diagnostics aligned around the same active-migration comparison behavior.
Validation
- Added regression coverage for diagnose migration history reporting a rolled-back migration as unapplied.
- Validated focused SQL migration history tests plus schema-engine, schema-command, and migration-test cargo checks from the PR workflow.
- Maintainer review refined the approach to filter active database migrations before matching, and the PR was merged with a backport candidate label.