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 从公开仓库中收录这些内容。

举报或申请下架