See it work
Refactor away schema debt, one safe operation at a time.
~2 min · the 3,503-track Chinook sample database · press space to pause, f for fullscreen ·
What it runs
import chinook.sqlAn existing schema becomes 138 typed operators — nothing dropped silently. TheINSERTs are set aside as replayable seed data.snapshot --data | psqlThe oplog compiles back to SQL and builds the whole database — schema and 3,503 rows — in one pipe.op add RenameColumn track.name titleA rename bound to the column's identity, not its name — the move a migration tool can't see. Every one of 3,503 titles kept.op add CastColumn track.milliseconds intervalintmilliseconds become a realinterval, batched with a second rename — several operators, one migration.op add DecomposeTable invoice → core + billingSplit a bloated table as one operator: both children created, all 412 rows moved, a shared key minted, the inbound FK re-pointed.drift db.dump.sqlSomeone patched prod by hand. Drift diffs a plainpg_dumpagainst the oplog and folds the change back in — no guessing.
The oplog becomes the source of truth. From it, retrofit renders
schema files and forward
and reverse migration scripts — no migrations/
folder to hand-maintain. It's all plain text, so changes diff, branch,
and merge in Git like the rest of your code. And every command can respond
--as=json, so an LLM agent can drive both code and schema changes.