# Migrate Convex Schemas and Backfill Data

Making a new field required can cause existing Convex records to fail validation. This skill guides you through staging the field, backfilling records, and checking data before enforcing the new requirement.

## Install

```bash
npx skillstore add convex/convex-migrate
```

## Metadata

- Status: approved
- Slug: convex-convex-migrate
- Skillstore revision: r1
- Version status: missing
- Tree hash: 6cb951afc635a8c7d4faac286507637b94abda86ed288177abaf4b6a7d97b076
- Author: convex
- GitHub username: convex
- Repository: https://github.com/convex/agent-skills/tree/603f4920e15334e26614dcdca44816a4007ee255/skills/convex-migrate
- Ref: 165dcddf07aeee8c7c0fb55773f9c3357eaa0d38
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Quality score: 73
- Public page: https://skillstore.pages.dev/skills/convex-convex-migrate
- Manifest: https://skillstore.pages.dev/api/skills/convex-convex-migrate/manifest

## Capabilities

- Plan a schema change that introduces a new field as optional.
- Guide installation of the @convex-dev/migrations package.
- Draft a migration to populate or transform existing records.
- Guide verification of row counts and record validity after a backfill.
- Identify when the validator can make the new field required.

## Use Cases

- Add a Required Field: Stage a new profile field as optional and plan the backfill before making the field required.
- Transform Stored Values: Draft a migration that maps legacy statuses into a new field. Flag any values that do not have an agreed mapping.
- Review a Deployment Plan: Review the order of schema changes and identify the checks needed before enforcing the new validator.

## Prompt Templates

### Explain the Migration Order

```
I need to add a required timezone field to my Convex profiles. Explain the migration order and what I should verify before making it required.
```

### Draft a Field Backfill

```
Draft a Convex migration using @convex-dev/migrations to set missing email alert preferences to false. Preserve existing values and show where the field should remain optional. Do not run the migration.
```

### Plan a Record Transformation

```
Plan a backfill from the legacy status field into a new status field using my approved mapping. Flag unmapped values for review and propose checks for row counts and record validity.
```

### Review a Live Migration

```
Review my proposed Convex rollout from an optional field to a required field. Check the backfill order and list the evidence needed before tightening the validator. Do not deploy or run anything.
```

## Limitations

- The skill provides instructions and does not bundle an executable migration.
- Running a migration requires a Convex project and access to the intended deployment.
- You must define how to populate values that cannot be inferred from existing records.
- The workflow does not provide rollback instructions.

## Best Practices

- Deploy new fields as optional before backfilling existing records.
- Confirm the target deployment and test the backfill outside production before running it on live data.
- Compare row counts and verify record validity before making the field required.

## Anti Patterns

- Make the new field required before existing records meet the requirement.
- Run the backfill without confirming the target deployment.
- Treat unchanged row counts as proof that the new field contains valid values.

## Security Audit

- Audited at: 2026-11-23T19:44:40.859\+00:00
- Summary: Static analysis reported no findings to adjudicate. Review found no evidence of prompt injection, data exfiltration, or instructions to bypass authorization. The skill is prompt-only and guides live data changes, so users should confirm the target deployment before execution.

## Stats

- Views: 0
- Downloads: 0
- Favorites: 0
- Popularity score: 0
