Cloudflare D1 Drizzle Migration

Safely run drizzle-kit migrations on Cloudflare D1 without losing data. Use when planning a drizzle migration that changes a column constraint (NULL → NOT NULL, type change, rename) or anything else that triggers a SQLite table rebuild. Covers the silent `PRAGMA foreign_keys=OFF` incompatibility that can cascade-delete child rows (a data-loss trap drizzle-kit defaults into), the phased NOT NULL column migration pattern (NULLABLE add → backfill → flip to NOT NULL) that works with a running production database, and the mandatory pre-deploy backup + post-deploy row count check runbook. Ends with 3 meta-level lessons that generalize beyond D1.

okayus 1eec949 5 files · 30.8 KB Updated

File contents

okayus/okayus-skills/tree/main/skills/cloudflare-d1-drizzle-migration commit 1eec9494a5

Frequently asked questions

npx skillmds@latest add okayus/cloudflare-d1-drizzle-migration