Know what your database changes will break.
Read a migration alongside the queries and application versions that still rely on the old schema.
Pull request #84
Rename the order total
public.orders id uuid total_cents integer amount_cents integer currency text 042_rename_total.sql
ALTER TABLE orders
RENAME COLUMN total_cents
TO amount_cents; Dependency review
2 dependent readers
orders.total_cents SELECT total_cents ! The current worker still requests the old column name.
A migration can execute successfully while an older worker continues to read the column it removed. Compatibility depends on the readers still in circulation.
Give old readers time to move.
Expand the schema, backfill existing rows and move readers before contracting it. Review each step while the change is still in a pull request.
Alternative migration sequence
Keep the old reader working
orders - 01 ExpandBoth application versions can read the original column.
Add amount_cents as a nullable integer.
- 02 BackfillDual-write new orders and verify row counts and values.
Copy total_cents into amount_cents.
- 03 Move readersDeploy the new reader before retiring the old one.
Update the receipt query and view.
- 04 ContractWait until all running revisions have stopped reading it.
Remove total_cents in a later migration.
041 · Receipt totals view
042 · Column rename in review
- Dependency evidence
- Review named queries and consuming services beside each changed column. An unknown consumer remains an open question.
- Destructive changes
- Dropping a column removes data even if every known query compiles. Review the backfill and retention decision separately.
- Migration history
- Preserve the transition order and revision so a reviewer can place a proposed change in the sequence already applied.
In the same workflow
How Schema fits into the planned x1991 workspace.
Availability
Concept
Release history
Schema is a proposed tool. The interfaces use illustrative data. A public release date has yet to be announced.
Read the Schema concept guide