fix(db): repair Drizzle migration snapshot parent collisions #481

Open
opened 2026-06-05 23:52:26 +00:00 by simon · 0 comments
Owner

While adding the incident workspace migration, pnpm --dir apps/web db:generate was blocked by existing Drizzle snapshot metadata collisions. The command printed these parent snapshot collisions and did not emit a new migration/snapshot:\n\n- lib/db/migrations/meta/0006_snapshot.json and 0007_snapshot.json point to parent lib/db/migrations/meta/0006_snapshot.json/snapshot.json\n- 0011_snapshot.json and 0012_snapshot.json point to parent lib/db/migrations/meta/0011_snapshot.json/snapshot.json\n- 0014_snapshot.json and 0015_snapshot.json point to parent lib/db/migrations/meta/0014_snapshot.json/snapshot.json\n\nImpact: future schema changes cannot rely on drizzle-kit generate; agents may need to hand-write migrations and carry snapshot placeholders, increasing drift risk.\n\nSuggested fix: inspect the affected snapshot id/prevId chain, regenerate or repair the metadata so Drizzle can diff from the latest schema normally, then add a regression check that drizzle-kit generate can run without these collision errors.

While adding the incident workspace migration, `pnpm --dir apps/web db:generate` was blocked by existing Drizzle snapshot metadata collisions. The command printed these parent snapshot collisions and did not emit a new migration/snapshot:\n\n- `lib/db/migrations/meta/0006_snapshot.json` and `0007_snapshot.json` point to parent `lib/db/migrations/meta/0006_snapshot.json/snapshot.json`\n- `0011_snapshot.json` and `0012_snapshot.json` point to parent `lib/db/migrations/meta/0011_snapshot.json/snapshot.json`\n- `0014_snapshot.json` and `0015_snapshot.json` point to parent `lib/db/migrations/meta/0014_snapshot.json/snapshot.json`\n\nImpact: future schema changes cannot rely on `drizzle-kit generate`; agents may need to hand-write migrations and carry snapshot placeholders, increasing drift risk.\n\nSuggested fix: inspect the affected snapshot `id`/`prevId` chain, regenerate or repair the metadata so Drizzle can diff from the latest schema normally, then add a regression check that `drizzle-kit generate` can run without these collision errors.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
carrtech/ct-ops#481
No description provided.