migrate-create
它能做什么
这项技能创建一个带编号的新数据库迁移,包括一个正向文件和一个撤销文件。适合有条理地修改数据库结构的开发者。
适用场景
- ✓当你需要为数据库添加表、列或索引时。
- ✓当你希望为每项改动创建对应的撤销文件时。
- ✓当你希望由系统为你选择下一个迁移编号时。
技能链接
https://github.com/ruvnet/ruflo/blob/main/plugins/ruflo-migrations/skills/migrate-create/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请创建一个迁移,为 tasks 表添加截止日期列,并附上它的撤销文件。”
每周 5 个新技能,1 分钟读完。
工作原理
这项技能找到现有的最大编号并加一,然后根据名称开头(例如 create、add 或 drop)选择模板。它会写入正向和撤销的 SQL 文件,并记录该迁移。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Migrate Create
Generate a new database migration with sequential numbering and up/down SQL file pair.
When to use
When you need to create a new database migration for schema changes such as creating tables, adding columns, creating indexes, or modifying constraints.
Steps
- Determine next number -- use
Globto scan the migrations directory for existing migration files and find the highest number, then increment by 1 (zero-pad to 3 digits) - Select template -- based on the
<name>, choose the appropriate SQL template:- Names starting with
create_-> CREATE TABLE template - Names starting with
add_-> ALTER TABLE ADD COLUMN template - Names starting with
drop_-> DROP with safety checks - Names containing
index-> CREATE INDEX template - Other -> generic migration template with placeholder comments
- Names starting with
- Generate up migration -- write
NNN_<name>.up.sqlwith the appropriate SQL using IF NOT EXISTS for idempotency - Generate down migration -- write
NNN_<name>.down.sqlwith the reverse operation using IF EXISTS - Search past patterns -- call
mcp__plugin_ruflo-core_ruflo__agentdb_pattern-search(ReasoningBank-routed; don't pass anamespaceargument — pattern-* tools ignore it). - Store metadata -- call
mcp__plugin_ruflo-core_ruflo__memory_store --namespace migrationsto record the migration with number, name, status (pending), and file paths. Thememory_*tool family routes by namespace;agentdb_hierarchical-*does NOT (it routes by tierworking|episodic|semantic), so usememory_*here. See ruflo-agentdb ADR-0001 §"Namespace convention". - Report -- display: migration number, file paths created, template used, any similar past migrations found
CLI alternative
npx @claude-flow/cli@latest memory store --namespace migrations --key "migration-NNN_NAME" --value '{"number": NNN, "name": "NAME", "status": "pending"}'
常见问题
模板是如何选择的?
由名称开头决定。以 create、add 或 drop 开头的名称使用各自的模板,包含 index 的名称使用索引模板。
它会运行这个迁移吗?
描述中涵盖创建文件和记录元数据,并未说明会执行该迁移。
它会检查 SQL 吗?
单独的 migrate validate 技能会检查待执行迁移的安全性。
详情
作者的原始描述
Create a new sequentially numbered database migration with up/down SQL files
repo: ruvnet/ruflo
热度
- GitHub 星标
- 81k
- 排名
- #1658
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
agent-adaptive-coordinator
81k帮你的智能体在工作量变化时拆分和重新平衡一组 AI 智能体,并选择适合任务的分工方式。
agent-agent
81k教你的智能体把一个大目标拆成有顺序的行动计划,并在情况变化时重新规划。
agent-agentic-payments
81k帮你的智能体管理 AI 购物的消费授权,包括消费上限、时间窗口、商户规则和签名审批。
agent-analyze-code-quality
81k帮你的智能体检查代码质量,找出代码异味、技术债务和重构建议,且不改动文件。