backend-migrations
按照可逆性、零停机部署和版本控制的最佳实践创建和管理数据库迁移。在创建迁移文件、修改数据库架构、添加或删除表/列、管理索引或执行数据转换时使用此技能。在处理迁移文件(migrations/*.ts、migrations/*.sql、*_migration.py)、Prisma 架构更改、Supabase 迁移或任何数据库演化任务时应用。此技能可确保使用回滚/向下方法进行可逆迁移、小型集中单更改迁移、零停机部署兼容性、分离的架构和数据迁移、大型表上安全的并发索引创建、清晰的描述性命名约定以及正确的版本控制实践(切勿修改已部署的迁移)。
📖 中文导读:按照可逆性、零停机部署和版本控制的最佳实践创建和管理数据库迁移。在创建迁移文件、修改数据库架构、添加或删除表/列、管理索引或执行数据转换时使用此技能。在处理迁移文件(migrations/*.ts、migrations/*.sql、*_migration.py)、Prisma 架构更改、Supabase 迁移或任何数据库演化任务时应用。此技能可确保使用回滚/向下方法进行可逆迁移、小型集中单更改迁移、零停机部署兼容性、分离的架构和数据迁移、大型表上安全的并发索引创建、清晰的描述性命名约定以及正确的版本控制实践(切勿修改已部署的迁移)。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。
name: Backend Migrations description: Create and manage database migrations following best practices for reversibility, zero-downtime deployments, and version control. Use this skill when creating migration files, modifying database schemas, adding or removing tables/columns, managing indexes, or performing data transformations. Apply when working on migration files (migrations/.ts, migrations/.sql, *_migration.py), Prisma schema changes, Supabase migrations, or any database evolution tasks. This skill ensures reversible migrations with rollback/down methods, small focused single-change migrations, zero-downtime deployment compatibility, separated schema and data migrations, safe concurrent index creation on large tables, clear descriptive naming conventions, and proper version control practices (never modify deployed migrations).
Backend Migrations
When to use this skill:
- When creating new database migration files
- When modifying existing database schemas (adding/removing tables or columns)
- When working on migration files (migrations/.ts, migrations/.sql, *_migration.py)
- When adding or modifying database indexes for performance
- When performing data migrations or transformations
- When implementing rollback/down methods for migrations
- When ensuring zero-downtime deployment strategies
- When managing schema versioning and migration order
- When separating schema changes from data migrations
- When working with Prisma migrate, Supabase migrations, or Entity Framework migrations
- When creating indexes on large PostgreSQL tables using concurrent options
- When planning backwards-compatible schema changes for high-availability systems
This Skill provides Claude Code with specific guidance on how to adhere to coding standards as they relate to how it should handle backend migrations.
Instructions
For details, refer to the information provided in this file: backend migrations