Co-evolve your code and schema, safely.

retrofit is the foundation under seismic changes to source code and database schema. Ship new features faster. Refactor away schema debt. Coming soon.

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

  1. import chinook.sql An existing schema becomes 138 typed operators — nothing dropped silently. The INSERTs are set aside as replayable seed data.
  2. snapshot --data | psql The oplog compiles back to SQL and builds the whole database — schema and 3,503 rows — in one pipe.
  3. op add RenameColumn track.name title A 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.
  4. op add CastColumn track.milliseconds interval int milliseconds become a real interval, batched with a second rename — several operators, one migration.
  5. op add DecomposeTable invoice → core + billing Split a bloated table as one operator: both children created, all 412 rows moved, a shared key minted, the inbound FK re-pointed.
  6. drift db.dump.sql Someone patched prod by hand. Drift diffs a plain pg_dump against 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.

No list, no noise — one message when it ships.

retrofit.sh