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 從公開儲存庫中收錄這些內容。

檢舉或申請下架