convex-migrate-rehearse

Rehearse Convex schema changes and backfills on snapshot-seeded preview deployments before promoting to production.

Updated Sep 17, 2026
One-click install
npx skills add https://github.com/Tehzeeb07/CodeRush --skill convex-migrate-rehearse-tehzeeb07
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: convex-migrate-rehearse
Source: https://github.com/Tehzeeb07/CodeRush/tree/main/.agents/skills/convex-migrate-rehearse
Command: npx skills add https://github.com/Tehzeeb07/CodeRush --skill convex-migrate-rehearse-tehzeeb07

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @convex-dev/migrations.

What problem does it solve? Convex validates every existing document against a new schema and fails the push if any row does not conform, so pushing an untested schema change directly to production risks a rejected deploy or broken data. This Skill turns a preview deployment into a rehearsal copy seeded with a production snapshot, letting the conformance gate fail safely on the copy before the proven change is promoted to prod. ## Core Features & Use Cases - Snapshot-seeded preview rehearsal: Export production data with npx convex export, create a preview deployment from pre-change code, and import the snapshot so the schema gate fails on the copy instead of prod. - Ordered migration workflow: Follows the optional-field-first pattern (make field optional, push, backfill with @convex-dev/migrations, verify, tighten validator, push again) on the preview before repeating the proven sequence on production. - Guarded promotion with rollback: Requires a fresh explicit confirmation before the prod promote and keeps the snapshot as a rollback artifact via npx convex import --replace --prod. - Use Case: You need to add a required role field to a Convex users table with millions of rows. Rehearse the schema change and batched backfill on a snapshot-seeded preview, verify the app against migrated data, then promote the exact proven sequence to production. ## Quick Start Rehearse my Convex schema change and backfill on a snapshot-seeded preview deployment, verify it, then promote the proven change to production with the snapshot kept as rollback.

Frequently Asked Questions about convex-migrate-rehearse

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

FAQPage Schema
How do I safely migrate a Convex schema on production data?▼

Rehearse the change on a preview deployment seeded with a production snapshot: export the data, create the preview from pre-change code, import the snapshot, then push the optional-field schema, run the backfill, and tighten the validator. Promote the proven sequence to prod only after explicit confirmation.

Why does my Convex schema push fail with existing documents?▼

Convex validates every existing document against the new schema and fails the push if any row does not conform. Skipping the optional-field-first step makes the very first push reject existing rows, so make new fields optional, backfill, then tighten.

Do Convex preview deployments require a special deploy key?▼

Yes, preview deployments need a Preview Deploy Key from dashboard Project Settings exported as CONVEX_DEPLOY_KEY, and it is a paid-tier feature. A plain npx convex login session cannot create previews; without a key, rehearse on a personal dev deployment seeded with the snapshot.

How do I run a backfill migration in Convex?▼

Use the @convex-dev/migrations component, which provides batched, resumable, dry-runnable backfills instead of ad-hoc one-shot mutations over a whole table. Run it against the preview first and verify every row is valid before tightening the schema.

What happens to production data if a Convex migration needs rollback?▼

The pre-migration snapshot serves as the rollback artifact via npx convex import snapshot.zip --replace --prod. Data written after the snapshot was taken is lost on restore, so keep the promote window short and treat the snapshot as sensitive data.