
D1 Migration
This handles the full Cloudflare D1 migration lifecycle with Drizzle ORM, from generating SQL to recovering from stuck migrations. The workflow emphasizes reading generated SQL before applying it because Drizzle sometimes creates destructive table recreations for simple changes like updating a default value. You get commands for local and remote migrations, diagnosis steps for partially applied migrations that get stuck, and fixes for common D1 gotchas like parameter limits on bulk inserts. Worth using if you've ever had a migration fail halfway through or wondered why your local database works but production breaks.
- skills.sh installs
- 1.2K
- GitHub stars
- 1.1K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add jezweb/claude-skills --skill d1-migration --agent claude-codeInstalls into .claude/skills of the current project.
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';
Sponsors
Details
- Repository
- github.com/jezweb/claude-skills
- Categories
- Backend & APIs, Debugging, Automation & Workflows, Cloud & Infrastructure, Databases
- First seen
- May 16, 2026
More from jezweb/claude-skills
All 166- Design System1.1K
- Onboarding Ux1.1K
- Roadmap1.1K
- Stripe Payments1.1K
- Tailwind Patterns1.1K
- Uk Business English1.1K
- App Docs1.1K
- Gws Setup1.1K
- Product Showcase1.1K
- Gws Install1.1K
- Strategy Document1.1K
- Team Update1K
- Us Business English1K
- Nextjs1K
- Design Loop1K
- Cloudflare Api997
- Parcel Tracking996
- Db Seed981
- Award Application971
- Nz Business English933
- Fork Discipline905
- Nemoclaw Setup902
- Motion785
- React Native Expo738