Convex Migrate

作者 get-convex2cfe645c87f9无许可证63 个星标收录于 2026年10月8日更新于 2026年10月8日仓库6天前更新

Migrate schema + backfill data on a deployed Convex app using @convex-dev/migrations.

AI 生成的概览

指导在已部署的 Convex 应用上分阶段修改 schema 并用 @convex-dev/migrations 回填数据。

功能
该技能提供一套工作流程,用于在不破坏现有数据的前提下修改已部署的 Convex schema。流程包括先把新字段设为可选、安装 @convex-dev/migrations、编写回填逻辑转换现有行、运行迁移、校验行的有效性与数量,最后才收紧 validator。它仅提供说明,不生成文件或脚本。
适用场景
当线上 Convex 应用需要修改 schema,且必须迁移现有行以满足新 schema 时使用。适用于分阶段、不中断的部署,只有在回填验证完成后才收紧 validator。
运行要求
需要已部署的 Convex 应用以及 @convex-dev/migrations 包。不附带脚本,仅提供说明。
<!-- GENERATED from convex-agents content/capabilities/migrate.json — do not edit by hand. -->

Migrate the schema / data on a live app

Change a deployed schema without breaking existing data: stage the schema change, install @convex-dev/migrations, write a backfill that makes old rows valid, run it, and verify before tightening the validator.

Workflow

  1. Make the new field optional first (so deploy doesn't reject existing rows).
  2. Install @convex-dev/migrations; write a migration that backfills/transforms existing rows.
  3. Run the migration; verify all rows are valid.
  4. Tighten the validator (make the field required) once the backfill is complete.

Rules

  • Never tighten a validator before the backfill completes — it rejects existing rows and breaks the live app.
  • Add new fields as optional first, migrate, then require.
  • Verify row counts before and after.

来源与署名

来源:get-convex/agent-skills位于skills/convex-migrate提交2cfe645

许可证: 无许可证

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架