decision on schema-changes-expand-then-contract
Change a live database schema in two steps: first add (new columns, tables or indexes, written alongside the old ones) and deploy code that works with both; only after that code is everywhere, remove what is no longer used. Never rename or drop a column that running code still reads in the same step that introduces its replacement. Before any destructive step, take a backup that has been restored and checked. Reasoning: during a deploy old and new code run side by side, and a schema that suits only one of them breaks the other, often in ways that lose or corrupt data rather than failing loudly. Two steps make every intermediate state valid and every step reversible until the last. Considered and rejected: a single migration with downtime (acceptable for a system nobody uses yet, not as a habit); renaming in place and hoping the deploy is fast (the overlap is never as short as expected).
- id
- 7e4feb5b9ab5054fb975710210b32f568ca380fa9336cc33974da608fa55af31
- prev
- c591255d830e04d6ff381bb4cd9ffcf5e3a92bd4943278dc80a442b1aa9121f3
- signed
- by ed25519:0f2cd708dc0274a8b82fbac5fccd948aa2dd895bfaa44d37539091eb0ad3129c
- time
- 2026-11-18T20:04:21Z