database-migrations
安全、可回滚的数据库迁移模式:仅向前推进的生产变更、expand-contract 零停机重命名、并发索引、分批回填,以及针对 PostgreSQL、Prisma、Drizzle、Kysely、Django 和 golang-migrate 的各工具工作流。适用于编写模式或数据迁移、为大表添加列或索引、规划回滚,或准备零停机部署。
机器翻译查看英文原文
Safe, reversible database migration patterns: forward-only production changes, expand-contract zero-downtime renames, concurrent indexes, batched backfills, and per-tool workflows for PostgreSQL, Prisma, Drizzle, Kysely, Django, and golang-migrate. Use when writing a schema or data migration, adding a column or index to a large table, planning a rollback, or preparing a zero-downtime deploy.
适用对象:数据库。自动收录 · 待核查。
原作者说明节选
从固定版本的 SKILL.md 提取,保留原文语言。以下内容属于作者说明,本站尚未验证安装、兼容或运行结果。
查看英文原文
原文涵盖的主题
- Database Migration Patterns
- When to Activate
- Core Principles
- Migration Safety Checklist
- PostgreSQL Patterns
- Adding a Column Safely
- Adding an Index Without Downtime
- Renaming a Column (Zero-Downtime)
Safe, reversible database schema changes for production systems. Creating or altering database tables Adding/removing columns or indexes Running data migrations (backfill, transform) Planning zero-downtime schema changes Setting up migration tooling for a new project 1. Every change is a migration — never alter production databases manually 2. Migrations are forward-only in production — rollbacks use new forward migrations 3. Schema and data migrations are separate — never mix DDL and DML in one migration 4. Test migrations against production-sized data — a migration that works on 100 rows may lock on 10M 5. Migrations are immutable once deployed — never edit a migration that has run in production Before applying any migration: [ ] Migration has both UP and DOWN (or is explicitly marked irreversible) [ ] No full table locks on large tables (use concurrent operations) [ ] New columns have defaults or are nullable (never add NOT NULL without default) [ ] Indexes created concurrently (not inline with CREATE TABLE for existing tables) [ ] Data backfill is a separate migration from schema change [ ] Tested against a copy of production data [ ] Rollback plan documented Never rename direc
这里只展示节选,请以完整原文和当前要求为准。
- 来源仓库
- affaan-m/ECC
- 源文件
- pi/core/skills/database-migrations/SKILL.md
- 固定版本
- d2ef2680594f9a17526a6e1a2e18b3d242c5d17b
来源与内容状态
本条为自动发现的元数据,尚未完成人工文档核查;适用性与运行结果待核查。
原作者:affaan-m/ECC · 原作者仓库元数据。文档核查:未核查。最近来源检查:2026-11-09T15:01:42.943Z。
分类由名称、说明与路径规则生成,分类不代表已核实适配。
许可与权利归属
MIT。第三方内容及版权归原作者,使用条件以原文为准。
许可原文 ↗本站没有因同步、复制或用户自报成功而将资源标为运行验证通过。
限制与注意事项
- 元数据收录不代表本站已经安装、适配、实测或进行安全审查。