cloudflare-d1-migrations

Coordinate Cloudflare D1 migrations across local, preview, and remote environments.

1|1|Updated May 3, 2026
One-click install
npx skills add https://github.com/matt-riley/agent-skills --skill cloudflare-d1-migrations
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cloudflare-d1-migrations
Source: https://github.com/matt-riley/agent-skills/tree/main/skills/cloudflare-d1-migrations
Command: npx skills add https://github.com/matt-riley/agent-skills --skill cloudflare-d1-migrations

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Coordinate Cloudflare D1 migrations across local, preview, and remote environments to prevent drift and ensure safe promotion.

Core Features & Use Cases

  • Create, inspect, apply, baseline, import, or recover Cloudflare D1 migrations across environments.
  • Respect Wrangler D1 inventory: binding, database_name, migrations_dir, and migrations_table, and adapt to preview usage to promote safely.
  • Use when Wrangler D1 migration state or schema drift is the main risk; supports preview-first promotion when configured.

Quick Start

Review the Wrangler D1 contract, then create and validate a migration locally before promoting.

Frequently Asked Questions about cloudflare-d1-migrations

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent schema drift when running Cloudflare D1 migrations across different environments?

To prevent schema drift in Cloudflare D1 migrations, coordinate creation, validation, and promotion across local, preview, and remote environments by reading Wrangler config and applying explicit ledger and schema checks before deployment.

What is the safest way to promote D1 migrations from a preview environment to remote?

Safe D1 migration promotion uses a preview-first approach, validating local state and respecting Wrangler D1 inventory bindings like database_name and migrations_dir before applying migrations to the remote environment.

How do I validate local D1 migration state against the Wrangler config before deploying?

Validating local D1 migration state involves reading the Wrangler D1 contract from config to check binding names, migrations_dir, and migrations_table, ensuring local files match the expected ledger state before promotion.

Can I recover or baseline Cloudflare D1 migration files if the ledger state becomes corrupted?

Recovering or baselining Cloudflare D1 migrations requires inspecting the current ledger and schema state, then using targeted import or recovery operations to realign migration files with the expected Wrangler D1 inventory.

Does this approach to D1 migrations work with custom migrations_dir and migrations_table settings in Wrangler?

Yes, D1 migration coordination adapts to custom Wrangler settings by reading the migrations_dir and migrations_table directly from the configuration contract, ensuring validation and promotion respect your specific inventory setup.