convex-seed

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
<!-- GENERATED from convex-agents content/capabilities/seed.json — do not edit by hand. -->
<!-- 由 convex-agents content/capabilities/seed.json 生成 — 请勿手动编辑。 -->

Seed / import data

植入/导入数据

Populate tables via an internalMutation seed function (re-runnable) or
npx convex import
, matching the schema.
通过可重复运行的internalMutation种子函数或
npx convex import
工具填充数据表,需匹配数据库架构。

Workflow

工作流程

  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.
  1. 对于测试数据:编写一个插入示例行的internalMutation;使用
    npx convex run
    运行它。
  2. 对于批量导入:调整数据格式以匹配架构,然后使用
    npx convex import
    工具。
  3. 确保植入操作具有幂等性(先清除再插入或更新插入),以便重复运行时是安全的。
  4. 验证行数。

Rules

规则

  • Seed via internalMutation or convex import, matching validators.
  • Make seeding idempotent.
  • Never seed secrets/PII into a shared deployment.
  • 通过internalMutation或convex import进行数据植入,需匹配验证器要求。
  • 确保植入操作具有幂等性。
  • 切勿将机密信息/个人可识别信息(PII)植入到共享部署环境中。