Seed

作者 get-convex6ca54f6e2e75無授權條款6 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫今天更新

Seed the Convex database with starter/fixture data or import an existing dataset (CSV/JSON). TRIGGER when the user wants sample/seed data or to import a dataset into Convex. Idempotent, schema-matching.

AI 產生的概覽

以冪等方式將範例資料填入 Convex 資料庫,或匯入 CSV/JSON 資料集。

功能
此技能說明如何將初始或範例資料填入 Convex 資料庫資料表:可撰寫 internalMutation 插入範例資料列,或使用 npx convex import 批次匯入既有的 CSV/JSON 資料集。內容涵蓋依 schema 驗證器調整資料、透過先清空再插入或 upsert 讓填入作業可重複執行,以及核對資料列數。它也提醒不要將機密或個人資料填入共用部署。
適用情境
當使用者想在 Convex 專案中取得範例或種子資料,或想把既有資料集匯入 Convex 時使用。適合需要可重複執行、符合 schema 的插入作業的初始化與範例資料載入情境。
執行需求
需要已定義 schema 的 Convex 專案,以及 Convex CLI(npx convex run、npx convex import)。此技能未附帶指令碼,僅為說明文件。

Seed / import data

Populate tables via an internalMutation seed function (re-runnable) or npx convex import, matching the schema.

Steps

  1. For fixtures: write an internalMutation that inserts sample rows; run it with npx convex run.
  2. For bulk import: shape the data to the schema and use npx convex import.
  3. Make seeding idempotent (clear-then-insert or upsert) so re-running is safe.
  4. Verify row counts.

Rules

  • Seed via internalMutation or convex import, matching validators.
  • Make seeding idempotent.
  • Never seed secrets/PII into a shared deployment.

來源與署名

來源:get-convex/convex-backend-skill位於skills/seed提交6ca54f6

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架