← 返回 Skills 市场
codekungfu

Db Migrate

作者 ClawKK · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
148
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install db-migrate
功能描述
Deep database migration workflow—expand/contract, backward-compatible deploys, backfills, locking risks, and verification. Use when changing production schem...
使用说明 (SKILL.md)

DB Migrations

Production schema changes fail when old and new code disagree during rollout. Prefer expand/contract: add compatible changes first, remove old shapes later.

When to Offer This Workflow

Trigger conditions:

  • ALTER TABLE in production; large table rewrites
  • Blue/green deploys coupled to schema state
  • Need zero-downtime or low-downtime migrations

Initial offer:

Use six stages: (1) classify change, (2) expand phase, (3) backfill & dual-write, (4) flip reads/writes, (5) contract phase, (6) verify & rollback). Confirm database engine (PostgreSQL, MySQL, etc.).


Stage 1: Classify Change

Goal: Additive vs destructive; lock risk (full table rewrite vs instant metadata change).

Exit condition: Migration labeled as expand or contract with risk notes.


Stage 2: Expand Phase

Goal: Add nullable columns or new tables without breaking currently deployed code.

Practices

  • Avoid DEFAULT clauses that lock large tables badly on some engines (use phased backfill instead)

Stage 3: Backfill & Dual-Write

Goal: Throttled batch backfill; dual-write old and new representations during transition when needed.


Stage 4: Flip Reads/Writes

Goal: Deploy code that reads new columns only after backfill completes; use feature flags for staged rollout.


Stage 5: Contract Phase

Goal: Drop old columns only after no code references them (search repo, logs, feature usage).


Stage 6: Verify & Rollback

Goal: Monitor errors, slow queries, replication lag; rollback = redeploy previous app version + avoid destructive steps until stable.


Final Review Checklist

  • Change classified; expand/contract path clear
  • Additive migrations before dependent code
  • Backfill throttled and verified
  • Read/write cutover sequenced with flags
  • Contract only after references gone
  • Monitoring and rollback tested

Tips for Effective Guidance

  • Long transactions on migrations can cause outages—chunk work.
  • Use online schema tools (pt-online-schema-change, etc.) when appropriate.

Handling Deviations

  • SQLite/embedded engines have different locking—validate per engine.
安全使用建议
This skill is a guidance document for performing safe DB migrations and appears internally consistent. Before using it, confirm how the agent will be given access to your codebase, logs, and production database: the SKILL.md suggests inspecting repo and logs (reasonable for verification) but the skill itself does not request credentials — you should avoid pasting production DB credentials into chat. If you let the agent run actions, grant only the minimum access needed (read-only access to schema/monitoring where possible), and verify any generated migration steps before applying them. If you prefer, treat this as a checklist for a human operator rather than an autonomous agent task.
功能分析
Type: OpenClaw Skill Name: db-migrate Version: 1.0.0 The skill bundle contains purely instructional documentation for performing safe database migrations using the expand/contract pattern. There is no executable code, no network activity, and no evidence of prompt injection or malicious intent in SKILL.md or _meta.json.
能力评估
Purpose & Capability
Name and description match the content of SKILL.md: it provides a six‑stage, zero/low‑downtime migration workflow and best practices. There are no unexpected environment variables, binary requirements, or install steps that would be inconsistent with a migration advisory.
Instruction Scope
The instructions are procedural guidance (classify, expand, backfill, cutover, contract, verify). A few items suggest actions like 'search repo, logs, feature usage' which could lead an agent to read project files or logs when performing the workflow — that is consistent with migration verification, but it implicitly expects access to repo/logs and monitoring data. The SKILL.md does not itself request specific credentials or paths, and it does not include commands that perform I/O or network calls.
Install Mechanism
No install spec and no code files — instruction-only. Nothing will be written to disk or downloaded by the skill itself, which minimizes install risk.
Credentials
The skill declares no required environment variables or credentials. The guidance refers to database engines and tools (pt-online-schema-change) but does not request keys or passwords. This is proportionate to an advisory workflow. Note: if an agent acting with this skill is later provided DB credentials by the user, the workflow would naturally use them — that is not a property of the skill itself.
Persistence & Privilege
The skill is not marked always:true and is user-invocable only. It does not request persistent privileges or modify other skills or global agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install db-migrate
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /db-migrate 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
db-migrate v1.0.0 – Initial Release - Introduces a comprehensive workflow for safe, low-downtime database schema migrations using the expand/contract pattern. - Details six migration stages: classify change, expand, backfill & dual-write, flip reads/writes, contract, and verify & rollback. - Provides practical advice on backfills, locking risk mitigation, and staged rollouts. - Includes a final review checklist and tips specific to production use and different database engines.
元数据
Slug db-migrate
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Db Migrate 是什么?

Deep database migration workflow—expand/contract, backward-compatible deploys, backfills, locking risks, and verification. Use when changing production schem... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 148 次。

如何安装 Db Migrate?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install db-migrate」即可一键安装,无需额外配置。

Db Migrate 是免费的吗?

是的,Db Migrate 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Db Migrate 支持哪些平台?

Db Migrate 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Db Migrate?

由 ClawKK(@codekungfu)开发并维护,当前版本 v1.0.0。

💬 留言讨论