migration-helper

Plan Convex schema migrations with backfill and batch execution patterns.

Updated Jun 8, 2024
One-click install
npx skills add https://github.com/shadeiskndr/portfolio --skill migration-helper-shadeiskndr
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migration-helper
Source: https://github.com/shadeiskndr/portfolio/tree/main/.agents/skills/migration-helper
Command: npx skills add https://github.com/shadeiskndr/portfolio --skill migration-helper-shadeiskndr

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you safely handle breaking Convex schema changes without losing or corrupting existing data, so your application can keep running while you evolve the database.

Core Features & Use Cases

  • Migration strategy guidance: Covers Convex’s model where schemas do not automatically migrate existing data, and explains what counts as safe vs breaking changes.
  • Step-by-step breaking change patterns: Shows how to add required fields safely (optional-first + backfill), change field types via additive structure, and rename fields with a data-copy migration.
  • Operational patterns for scale: Provides batch processing approaches, scheduled (cron) migrations, and a dual-write pattern for zero-downtime transitions.
  • Validation checklist and pitfalls: Includes a practical migration checklist and common mistakes to avoid (e.g., making fields required immediately or deleting old fields too soon).

Quick Start

Use the migration-helper to plan your next Convex schema change by identifying whether it is additive or breaking, then follow the provided backfill and batch migration patterns to move existing documents before updating application code.

Frequently Asked Questions about migration-helper

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

FAQPage Schema
How do I safely migrate Convex schemas without downtime?

Zero-downtime Convex schema migration requires optional-first additive updates to evolve the database while the application runs. You apply backfills via internal mutations and verify data before finalizing breaking changes.

What is a breaking change in Convex and how do I handle existing data?

A breaking Convex schema change includes adding required fields or changing field types. Because Convex does not auto-migrate existing data, you must use a backfill mutation to update current documents before enforcing the new schema.

How do I add a required field to existing Convex documents?

To add a required field to existing Convex documents, first add it as an optional field, run an internal mutation to backfill the default value for all documents, and then update the schema to make it required.

Can I use cron jobs for batch data backfills in Convex?

Yes, you can use scheduled cron jobs for batch data backfills in Convex. This operational pattern allows you to process large datasets incrementally with verification checkpoints, ensuring zero-downtime during migration.

What is the best way to rename a field in a Convex table?

The best way to rename a Convex field is an additive data-copy migration. You add the new field, backfill it from the old field using internal mutations, update application code to dual-write, and then remove the old field.

Why should I not delete old fields immediately after a Convex schema migration?

Deleting old fields immediately risks data loss if the backfill failed or application code was not fully updated. You should use a dual-write pattern and maintain the old field until you verify the new schema is fully operational.