
D1 Migration
Migration workflow for Cloudflare D1 that generates with Drizzle and flags destructive SQL before applying.
- skills.sh installs
- 1.2K
- GitHub stars
- 1.1K
- last updated
- Aug 21, 2026
What it does
- Covers generating, inspecting, applying, and verifying D1 migrations across local and remote databases
- Includes fixes for stuck migrations, duplicate-column failures, and batching large bulk inserts past D1's parameter limit
- Enforces a rule to read generated SQL first, since column default changes can trigger destructive table recreation
- Designed for teams using Drizzle ORM on Cloudflare D1 who need to set up or repair schemas
Install
$ npx -y skills add jezweb/claude-skills --skill d1-migration -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
D1 Migration Workflow
Guided workflow for Cloudflare D1 database migrations using Drizzle ORM.
Standard Migration Flow
1. Generate Migration
pnpm db:generate
This creates a new .sql file in drizzle/ (or your configured migrations directory).
2. Inspect the SQL (CRITICAL)
Always read the generated SQL before applying. Drizzle sometimes generates destructive migrations for simple schema changes.
Red Flag: Table Recreation
If you see this pattern, the migration will likely fail:
CREATE TABLE `my_table_new` (...);
INSERT INTO `my_table_new` SELECT ..., `new_column`, ... FROM `my_table`;
-- ^^^ This column doesn't exist in old table!
DROP TABLE `my_table`;
ALTER TABLE `my_table_new` RENAME TO `my_table`;
Cause: Changing a column's default value in Drizzle schema triggers full table recreation. The INSERT SELECT references the new column from the old table.
Fix: If you're only adding new columns (no type/constraint changes on existing columns), simplify to:
ALTER TABLE `my_table` ADD COLUMN `new_column` TEXT DEFAULT 'value';
Details
- Repository
- github.com/jezweb/claude-skills
- Categories
- Databases, Backend & APIs
- First seen
- May 16, 2026
More from jezweb/claude-skills
All 64- Stripe Payments1.1K
- App Docs1.1K
- Roadmap1.1K
- Uk Business English1.1K
- Gws Setup1.1K
- Product Showcase1.1K
- Gws Install1.1K
- Strategy Document1.1K
- Us Business English1.1K
- Team Update1.1K
- Design Loop1K
- Parcel Tracking1K
- Cloudflare Api1K
- Award Application984
- Db Seed983
- Nz Business English945
- Fork Discipline916
- Nemoclaw Setup915
- React Native Expo738
- Ux Extract701
- Ux Compare675
- Image Gen350
- Shadcn Ui3.6K
- Color Palette3.4K
Similar to D1 Migration
More Databases
d1-drizzle-schemajezweb/claude-skills1.7K installsGenerate Drizzle ORM schemas for Cloudflare D1 with D1-specific column patterns, migrations, and docs.
drizzle-migrationsbobmatnyc/claude-mpm-skills1.3K installsMigration-first Drizzle ORM workflow for TypeScript projects that writes SQL migrations before schema code.
drizzle-safe-migrationspedronauck/skills347 installsSafe Drizzle migration workflow that orders data backfills before schema constraint changes, with rollout and rollback checks.
drizzle-ormmindrally/skills1.1K installsLightweight type-safe TypeScript ORM guidelines covering schemas, connections, queries, migrations, and performance.