🗄️
DevOpsJavaScript

Database Migrations

by xu-xiang

Database Migrations is a DevOps skill for Claude Code, published by xu-xiang in everything-claude-code-zh.

1.9K stars307 forkson xu-xiang/everything-claude-code-zhAdded 2026/08/18+1% in starsRepository updated 2026/03/05
ai-agentsanthropicclaudeclaude-codedeveloper-toolseverything-claude-codellmmcponeskillproductivity
Install in seconds
Install Database Migrations
Copy Database Migrations into your Claude Code skills folder. Run the command in your terminal, or review the source on GitHub before installing.
terminal
npx degit https://github.com/xu-xiang/everything-claude-code-zh/tree/main/skills/database-migrations ~/.claude/skills/database-migrations

Requires Node.js. Downloads this skill only — not the rest of the repository — into your Claude Code skills folder.

Without Node.js

git clone https://github.com/xu-xiang/everything-claude-code-zh.git

Clones the whole repository, then copy the skill’s own directory into your skills folder yourself.

In this catalog

Source file
skills/database-migrations/SKILL.md in xu-xiang/everything-claude-code-zh
Installs to
~/.claude/skills/database-migrations
Collection
One of 25 skills cataloged from this repository
Category
DevOps798 skills

What Database Migrations does

Database Migrations covers safe, reversible schema changes across PostgreSQL, MySQL, and common ORMs like Prisma, Drizzle, Django, and golang-migrate, with zero-downtime patterns. Use it when creating or altering tables, adding indexes, backfilling data, or planning production migrations.

Database Migrations is cataloged under DevOps on DirSkills. Database Migrations comes from a repository tagged ai-agents, anthropic, claude, claude-code and developer-tools.

Documentation

README

数据库迁移模式(Database Migration Patterns)

面向生产系统的安全、可逆的数据库模式变更(Schema Changes)。

激活时机

  • 创建或修改数据库表
  • 添加/删除列或索引
  • 执行数据迁移(数据回填 backfill、转换 transform)
  • 规划零停机(zero-downtime)模式变更
  • 为新项目设置迁移工具链

核心原则

  1. 所有变更皆为迁移 —— 严禁手动修改生产环境数据库
  2. 生产环境仅向前迁移 —— 回滚需使用新的向前迁移(forward migrations)
  3. 模式迁移与数据迁移分离 —— 严禁在一次迁移中混用 DDL 和 DML
  4. 针对生产规模数据进行测试 —— 在 100 行数据上正常的迁移可能会导致 1000 万行数据锁表
  5. 部署后的迁移不可变 —— 严禁编辑已在生产环境运行过的迁移文件

迁移安全核查表(Migration Safety Checklist)

在执行任何迁移之前:

  • 迁移包含 UP 和 DOWN 脚本(或明确标记为不可逆)
  • 对大表不执行全表锁(使用并发操作)
  • 新列具有默认值或可为空(严禁添加不带默认值的 NOT NULL)
  • 索引并发创建(对于现有表,不与 CREATE TABLE 同行执行)
  • 数据回填与模式变更分为独立迁移
  • 已针对生产数据副本进行测试
  • 已记录回滚方案

PostgreSQL 模式

安全地添加列

This is the opening of the README. Read the full README on GitHub.

Frequently asked about Database Migrations

  • What else does xu-xiang publish alongside Database Migrations?

    Database Migrations is one of 25 skills that DirSkills catalogs from xu-xiang/everything-claude-code-zh, the repository it ships in. Its siblings there include API Design Patterns, Article Writing and Autonomous Loops. Each one is a separate skill with its own page in this directory, installs the same way Database Migrations does, and is maintained by xu-xiang in that same repository. The rest of the collection is listed on the xu-xiang/everything-claude-code-zh page.

  • How does Database Migrations compare to other DevOps skills?

    Database Migrations ranks #280 by stars among the 798 DevOps skills in this catalog. The most-starred ones next to it are Backend Patterns, API Connector Builder and Migration. DirSkills ranks by the star count of the repository each skill ships in, so that order reflects how popular those repositories are rather than any review of Database Migrations against them. Open each page to compare what they document and how they install.

More from xu-xiang/everything-claude-code-zh

Database Migrations is one of 25 skills cataloged on DirSkills from xu-xiang/everything-claude-code-zh.

See all 25 skills
📐
2w ago

API Design Patterns

API Design Patterns provides conventions and best practices for designing consistent, developer-friendly REST APIs, including resource naming, HTTP status codes, pagination, filtering, error responses, versioning, and rate limiting.
DevOps
1.9K307
✍️
2w ago

Article Writing

Article Writing drafts long-form content such as articles, guides, tutorials, and newsletters in a specific voice captured from examples or brand guidelines. Use it when you need polished copy longer than a paragraph with consistent tone, structure, and credibility.
Writing
1.9K307
🔁
2w ago

Autonomous Loops

Autonomous Loops provides patterns and architectures for running Claude Code without human intervention, from simple claude -p pipelines to RFC-driven multi-agent DAG orchestration. Use it to set up autonomous development workflows, CI/CD pipelines, parallel agents, and quality gates.
Automation
1.9K307
⚙️
2w ago

Backend Patterns

Backend Patterns provides architectural patterns and best practices for building scalable server-side applications, covering REST API design, repository/service layers, database optimization, caching, and error handling. Use it when implementing Node.js, Express, or Next.js API routes.
DevOps
1.9K307
🛠️
2w ago

C++ Coding Standards

C++ Coding Standards provides a set of rules and best practices based on the C++ Core Guidelines for writing modern, safe, and idiomatic C++ code. Use it when writing, reviewing, or refactoring C++ code to enforce type safety, resource safety, immutability, and clarity.
Quality
1.9K307
🧪
2w ago

C++ Testing

C++ Testing guides writing and debugging C++17/20 tests with GoogleTest/Mock, CMake/CTest, coverage, and sanitizers. Use it when creating or fixing C++ tests, configuring CI test gates, or diagnosing flaky failures.
Quality
1.9K307