Concepts

Corrected migrations

When a change is unsafe, flagging it is the floor. Sieve can also write the safe version and open it as a follow-up PR — the same expand-and-contract plan, as committed SQL you can review and merge.

What it does

For an unsafe change, Sieve derives the phased migration — backfill before a NOT NULL, a validated NOT VALID check, an index built concurrently, a drop deferred to its own migration — and commits it to a branch. It then opens a PR pointed at your original, so the fix sits next to the change that needed it.

How to turn it on

Autofix is off by default — opening a PR on someone's repo is intrusive and has to be invited. Enable it in .sieve.yml:

  • autofix: true opts the repo in.
  • Sieve only opens a fix PR when it rewrites a genuinely unsafe change, not for advisory notes.
  • Correction PRs are skipped by review, so Sieve never reviews its own fix in a loop.
It's a suggestion, not a force-push
The corrected migration arrives as an ordinary PR. You read it, edit it, or close it. Sieve never rewrites your migration in place.
Sieve · Docs · Corrected migrations