convex-migration-helper
Skill628 starsChanged 7 months agoMITView on GitHub
Plans Convex schema and data migrations with widen-migrate-narrow and @convex-dev/migrations. Use for breaking schema changes, backfills, table reshaping, or zero-downtime rollouts.
15 other projects use a version of this, 14 of them edited.
Adopted by
Most recently taken up by
- get-convex/workflowedited, first seen Oct 9, 2026
- moltbot/molthubedited, first seen Oct 8, 2026
- get-convex/convex-helpersedited, first seen Oct 8, 2026
- clawdbot/clawdhubedited, first seen Oct 8, 2026
- pingdotgg/lawnedited, first seen Oct 8, 2026
- openclaw/clawhubedited, first seen Oct 8, 2026
Used with
Projects with it also use clawhub-ban-appeals, clawhub-clawscan and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
openclawSkillclawhub-ban-appeals
Review ClawHub account-ban appeals, distinguish bans from moderation holds or blocked releases, and prepare an evidence-backed moderation decision. Route validated scanner inaccuracies to clawhub-clawscan.
Also in 3 projects that use this
openclawSkillclawhub-clawscan
Investigate ClawScan health alerts, diagnose scanner or ClawHub integration failures, prepare operational repairs, and route validated verdict inaccuracies upstream. Account ban appeals use clawhub-ban-appeals.
Also in 3 projects that use this
FabienGreardSkillconvex-acquire-domain
Find and buy a domain for the current Convex app through Convex, then bind it (labs; spend action).
Also in 3 projects that use this
- +9 more from openclaw
Other versions15 projects use a version of this.
Word for word · 1
- raroque/boop-agent★ 1.3k100% same
Edited · 14
- openclaw/clawhub★ 9.6k97% same
- clawdbot/clawdhub★ 9.5k97% same
- moltbot/molthub★ 9.5k97% same
- pingdotgg/lawn★ 69097% same
- get-convex/convex-helpers★ 49691% same
- get-convex/workflow★ 8691% same
- sholajegede/mastra-vs-langchain★ 1797% same
- vantageos-agency/vantage-peers★ 491% same
- Decentralized-Rights-Protocol/Dr-Blockchain★ 291% same
- fiinytid/nexusai.gg★ 297% same
4 more not listed
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- public/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/convex2.mdcCursor rule
- .cursor/rules/convex-doctor.mdcCursor rule
- .cursor/rules/convex-write-conflicts.mdcCursor rule
- .cursor/rules/dev2.mdcCursor rule
- .cursor/rules/gitruels.mdcCursor rule
- .cursor/rules/help.mdcCursor rule
- .cursor/rules/rulesforconvex.mdcCursor rule
- .cursor/rules/sec-check.mdcCursor rule
- .cursor/rules/task.mdcCursor rule
- .cursor/rules/workflow.mdcCursor rule
- .cursor/rules/write.mdcCursor rule
- public/llms.txtllms.txt
- convex-create-componentSkill
- convex-performance-auditSkill
- convex-quickstartSkill
- convex-setup-authSkill
- convexSkill
- impeccableSkill
- convex-quickstartSkill
- convex-setup-authSkill
- devSkill
- function-creatorSkill
- gitrulesSkill
- helpSkill
- migration-helperSkill
- react-effect-decisionSkill
- real-time-backendSkill
- schema-builderSkill
- sec-checkSkill
- workflowSkill
- writeSkill
- convex-doctorSkill
- convex-return-validatorsSkill
- convex-self-hostingSkill
- create-prdSkill
- robel-authSkill
- update-project-docsSkill
The file
We split this skill into the rules it gives an agent
11 rules. 8 are common, 1 is distinctive, and 2 are very specific to this project.
8
Common
Most of the 14 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 44
When changing the shape of data, create a new field rather than modifying an existing one.
- Common: line 87
Every breaking migration follows the same multi-deploy pattern:
- Common: line 91
Update schema to allow both old and new formats (e.g., add optional new field)
- Common: line 92
Update code to handle both formats when reading
- Common: line 93
Update code to write the new format for new documents
- Common: line 98
Run migration to backfill existing documents
- Common: line 99
Verify all documents are migrated
- Common: line 103
Update schema to require the new format only
- Common: line 104
Remove code that handles the old format
- Very specific: line 131
Skipping the dry run: Use dryRun: true to validate migration logic before committing changes to production data.
- Very specific: line 132
Deleting fields prematurely: Prefer deprecating with v.optional and a comment.
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Convex Migration Helper
Safely migrate Convex schemas and data when making breaking changes.
When to Use
- Adding new required fields to existing tables
- Changing field types or structure
- Splitting or merging tables
- Renaming or deleting fields
- Migrating from nested to relational data
When Not to Use
- Greenfield schema with no existing data in production or dev
- Adding optional fields that do not need backfilling
- Adding new tables with no existing data to migrate
- Adding or removing indexes with no correctness concern
- Questions about Convex schema design without a migration need
Key Concepts
Schema Validation Drives the Workflow
Convex will not let you deploy a schema that does not match the data at rest. This is the fundamental constraint that shapes every migration:
- You cannot add a required field if existing documents don't have it
- You cannot change a field's type if existing documents have the old type
- You cannot remove a field from the schema if existing documents still have it
This means migrations follow a predictable pattern: widen the schema, migrate the data, narrow the schema.
Online Migrations
Convex migrations run online, meaning the app continues serving requests while data is updated asynchronously in batches. During the migration window, your code must handle both old and new data formats.
Prefer New Fields Over Changing Types
When changing the shape of data, create a new field rather than modifying an existing one. This makes the transition safer and easier to roll back.
Don't Delete Data
Unless you are certain, prefer deprecating fields over deleting them. Mark the field as v.optional and add a code comment explaining it is deprecated and why it existed.
Safe Changes (No Migration Needed)
Adding Optional Field
// Before
users: defineTable({
name: v.string(),
});
// After - safe, new field is optional
users: defineTable({
name: v.string(),
bio: v.optional(v.string()),
});Adding New Table
posts: defineTable({
userId: v.id("users"),
title: v.string(),
}).index("by_user", ["userId"]);Adding Index
users: defineTable({
name: v.string(),
email: v.string(),
}).index("by_email", ["email"]);Breaking Changes: The Deployment Workflow
Every breaking migration follows the same multi-deploy pattern:
Deploy 1 - Widen the schema:
- Update schema to allow both old and new formats (e.g., add optional new field)
- Update code to handle both formats when reading
- Update code to write the new format for new documents
- Deploy
Between deploys - Migrate data:
- Run migration to backfill existing documents
- Verify all documents are migrated
Deploy 2 - Narrow the schema:
- Update schema to require the new format only
- Remove code that handles the old format
- Deploy
Using the Migrations Component
For any non-trivial migration, use the @convex-dev/migrations component. It handles batching, cursor-based pagination, state tracking, resume from failure, dry runs, and progress monitoring.
See references/migrations-component.md for installation, setup, defining and running migrations, dry runs, status monitoring, and configuration options.
Common Migration Patterns
See references/migration-patterns.md for complete patterns with code examples covering:
- Adding a required field
- Deleting a field
- Changing a field type
- Splitting nested data into a separate table
- Cleaning up orphaned documents
- Zero-downtime strategies (dual write, dual read)
- Small table shortcut (single internalMutation without the component)
- Verifying a migration is complete
Common Pitfalls
- Making a field required before migrating data: Convex rejects the deploy because existing documents lack the field. Always widen the schema first.
- Using
.collect()on large tables: Hits transaction limits or causes timeouts. Use the migrations component for proper batched pagination..collect()is only safe for tables you know are small. - Not writing the new format before migrating: Documents created during the migration window will be missed, leaving unmigrated data after the migration "completes."
- Skipping the dry run: Use
dryRun: trueto validate migration logic before committing changes to production data. Catches bugs before they touch real documents. - Deleting fields prematurely: Prefer deprecating with
v.optionaland a comment. Only delete after you are confident the data is no longer needed and no code references it. - Using crons for migration batches: The migrations component handles batching via recursive scheduling internally. Crons require manual cleanup and an extra deploy to remove.
Migration Checklist
- Identify the breaking change and plan the multi-deploy workflow
- Update schema to allow both old and new formats
- Update code to handle both formats when reading
- Update code to write the new format for new documents
- Deploy widened schema and updated code
- Define migration using the
@convex-dev/migrationscomponent - Test with
dryRun: true - Run migration and monitor status
- Verify all documents are migrated
- Update schema to require new format only
- Clean up code that handled old format
- Deploy final schema and code
- Remove migration code once confirmed stable
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

