← ClaudeAtlas

schema-changelisted

Ship a Drizzle schema change in buildd without losing a migration, a column, or a release. Covers generating migrations, the index collisions that happen several times a day with concurrent sessions, dropping things safely, and unblocking the release drift gate.
buildd-ai/buildd · ★ 1 · AI & Automation · score 70
Install: claude install-skill buildd-ai/buildd
# Shipping a Schema Change `packages/core/db/schema.ts` is the source of truth. Everything else — the SQL in `packages/core/drizzle/`, the snapshots, the journal — is **generated**. The whole skill is one rule and its consequences: > **Generate. Never hand-edit a migration, a snapshot, or the journal.** Hand-editing is how a snapshot stops describing the schema, and a snapshot that lies is invisible until a deploy fails or a column silently isn't there. ## The normal path ```bash # 1. edit packages/core/db/schema.ts cd packages/core && bun db:generate # emits drizzle/NNNN_*.sql + meta/ # 2. read the emitted SQL. Every time. It is short. # 3. commit schema.ts AND drizzle/ together ``` CI fails if `schema.ts` changed without committed migration files. Migrations auto-run on Vercel deploy. **Never `db:push`** — it bypasses migration tracking. ## Index collisions — expect these, they are not bad luck Many sessions work this repo at once and each runs `db:generate`. A branch open for a few hours routinely collides two to four times. Git will **not** warn you: the `.sql` files have different generated names so they merge cleanly; only `meta/_journal.json` and the snapshot conflict. A collision can survive a clean-looking merge and only show up as a failed deploy. **Check immediately before every push that touches `drizzle/`:** ```bash git fetch -q origin dev git show origin/dev:packages/core/drizzle/meta/_journal.json | python3 -c \ "import json,sys;e=json.load(sys.