convex-migrate
它能做什么
这个技能会更新已有真实数据的 Convex 应用的数据库结构。适合需要在不破坏线上应用的前提下修改数据表的开发者。
适用场景
- ✓当你想为已有记录的数据表添加必填字段时。
- ✓当你需要在线上应用中重命名、修改或拆分字段时。
- ✓当你需要在收紧规则之前,为旧记录补齐缺失的值时。
技能链接
https://github.com/openclaw/clawhub/blob/main/.agents/skills/convex-migrate/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我的 users 表添加一个必填的 email 字段,同时不影响我已有的用户。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会先把新字段设为可选,安装迁移库,编写一个为旧记录填充数据的步骤并运行,检查记录数量,然后才将该字段设为必填。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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
- Make the new field optional first (so deploy doesn't reject existing rows).
- Install @convex-dev/migrations; write a migration that backfills/transforms existing rows.
- Run the migration; verify all rows are valid.
- 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.
常见问题
为什么不直接把字段设为必填?
现有记录会不符合新规则,从而导致线上应用出错。
智能体怎么知道迁移成功了?
它会比较迁移前后的记录数量,并在收紧规则之前检查所有记录是否有效。
它使用哪个库?
它使用 Convex 迁移库,该库会分批运行变更,同时应用保持正常运行。
详情
作者的原始描述
Migrate schema + backfill data on a deployed Convex app using @convex-dev/migrations.
repo: openclaw/clawhub
热度
- GitHub 星标
- 9.5k
- 排名
- #12249
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
axiom-alerting
9.5k帮你的智能体通过 Axiom API 创建和管理监控器与通知路由,并检查告警是否按预期运行。
axiom-sre
9.5k帮你的智能体逐步调查生产事故和缺陷,在得出结论之前,用 Axiom 日志验证每一个猜测。
building-dashboards
9.5k帮你的智能体从仪表盘必须支持的决策出发,设计配有合适图表、查询和筛选器的 Axiom 仪表盘。
controlling-costs
9.5k帮你的智能体在 Axiom 中找出未被使用的数据,并构建用于追踪和削减日志成本的仪表盘与监控器。