convex-migration-helper

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

1|Updated Oct 10, 2025
One-click install
npx skills add https://github.com/Rocktown-Labs/rivercitymd --skill convex-migration-helper-rocktown-labs
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-migration-helper
Source: https://github.com/Rocktown-Labs/rivercitymd/tree/main/.agents/skills/convex-migration-helper
Command: npx skills add https://github.com/Rocktown-Labs/rivercitymd --skill convex-migration-helper-rocktown-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Breaking schema changes in Convex cannot deploy while existing data violates the new schema, forcing developers to coordinate multi-step migrations without downtime or data loss. ## Core Features & Use Cases - Widen-Migrate-Narrow Workflow: Guides the multi-deploy pattern of widening the schema, backfilling data, then narrowing the schema for breaking changes. - Migrations Component Integration: Uses @convex-dev/migrations for batched, resumable migrations with dry runs, status monitoring, and cursor-based pagination. - Pattern Library: Provides reference implementations for adding required fields, changing field types, splitting nested data into tables, and zero-downtime dual-write or dual-read strategies. - Use Case: When adding a required role field to an existing users table, the Skill walks you through deploying an optional field, backfilling with a migration, verifying completion, and then making the field required. ## Quick Start Ask the assistant to plan a safe migration for adding a required field to an existing Convex table with production data.

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 run a migration with @convex-dev/migrations to backfill existing documents. After verifying all documents are migrated, deploy a final schema making the field required.

How do I run a Convex data migration in production?▼

Define the migration with migrations.define from @convex-dev/migrations, test it with a dry run using npx convex run migrations:myMigration '{"dryRun": true}', then run it with npx convex run migrations:myMigration --prod and monitor status.

Why does Convex reject my schema deploy after changing a field?▼

Convex validates that the schema matches data at rest, so it rejects deploys where existing documents violate the new schema, such as missing a newly required field. Widen the schema to accept both formats, migrate the data, then narrow the schema.

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

Using .collect() is only safe for small tables of a few thousand documents in a single internalMutation. Larger tables hit transaction limits or timeouts, so use the @convex-dev/migrations component for batched, resumable processing.

When is a Convex migration not needed?▼

No migration is needed for adding optional fields, adding new tables, or adding indexes, since these do not conflict with existing data. Greenfield schemas with no production data also require no migration.