convex-migration-helper

Plans and executes Convex schema and data migrations using the widen-migrate-narrow workflow.

Updated Jul 3, 2026
One-click install
npx skills add https://github.com/alex-jordan547/agent-setup --skill convex-migration-helper-alex-jordan547
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: convex-migration-helper
Source: https://github.com/alex-jordan547/agent-setup/tree/main/archive/convex-migration-helper
Command: npx skills add https://github.com/alex-jordan547/agent-setup --skill convex-migration-helper-alex-jordan547

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @convex-dev/migrations, and includes references (resource) components.

What problem does it solve? Convex rejects deployments when the schema does not match existing data, so breaking changes like adding required fields, changing types, or splitting tables cannot ship directly. This Skill guides the multi-deploy widen-migrate-narrow workflow so migrations complete without downtime or data loss. ## Core Features & Use Cases - Multi-Deploy Migration Planning: Structures every breaking change as widen schema, backfill data, then narrow schema, with a full checklist. - Migrations Component Integration: Uses @convex-dev/migrations for batched, resumable migrations with dry runs, status monitoring, and cancellation. - Pattern Library: Reference guides cover adding required fields, deleting fields, changing types, splitting nested data into tables, cleaning orphaned documents, and dual-write or dual-read zero-downtime strategies. - Use Case: You need to convert a boolean isPro field into a plan enum on a production teams table. The Skill walks you through adding the optional new field, backfilling with a migration, verifying completion, and narrowing the schema in a final deploy. ## Quick Start Ask the assistant to plan a safe migration for adding a required role field to the existing users table in your Convex app.

Frequently Asked Questions about convex-migration-helper

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

FAQPage Schema
How do I add a required field to an existing Convex table?

Add the field as optional first, deploy code that writes it for new documents, then backfill existing documents with a migration using @convex-dev/migrations. After verifying all documents are migrated, deploy a final schema that makes the field required.

How do I run a data migration in Convex without downtime?

Use the widen-migrate-narrow pattern: widen the schema to accept both formats, run an online batched migration, then narrow the schema. During the window, use dual write (write both formats, read old) or dual read (read both, write new) so the app keeps serving requests.

Why does my Convex deploy fail with a schema validation error?

Convex rejects deploys when the schema does not match data at rest, such as adding a required field that existing documents lack or changing a field type. Widen the schema to allow both formats and migrate the data before narrowing.

Can I use .collect() to migrate a Convex table?

Only for small tables of a few thousand documents, via a single internalMutation. Larger tables hit transaction limits or timeouts, so use the @convex-dev/migrations component which handles batched pagination, resume from failure, and progress tracking.

How do I test a Convex migration before running it on production data?

Run the migration with dryRun set to true, for example npx convex run migrations:runIt '{"dryRun": true}'. This executes one batch and rolls back, letting you validate the migration logic without changing any documents.

When should I not use a migration in Convex?

Skip migrations for greenfield schemas with no existing data, adding optional fields that need no backfill, adding new empty tables, or adding indexes. These changes deploy safely without touching existing documents.