AGENT SKILL
postgres-migrations
Write safe, reversible, zero-downtime PostgreSQL schema migrations
- License 许可
- Apache-2.0
- 所属仓库
- linktogo/maggie
- 最近更新
- 2026-11-14
- Stars
- ★ 2
- Forks
- 2
01 前言 Front Matter
- name
- postgres-migrations
- globs
- [ "**/migrations/**/*.sql", "**/migrations/**/*.ts" ]
- description
- Write safe, reversible, zero-downtime PostgreSQL schema migrations
03 SKILL.md 正文
PostgreSQL migrations
Every schema change ships as a migration that is forward-only in production but reversible in review. Never edit the database by hand.
Rules
- One logical change per migration; give it a timestamped, descriptive name.
- Each migration is idempotent-safe to re-run where the tooling supports it, and
has a matching
downthat truly reversesup. - Make column additions non-breaking: add nullable or with a default, backfill
in a separate step, then add the
NOT NULLconstraint once data is clean. - Adding an index on a large table? Use
CREATE INDEX CONCURRENTLY(outside a transaction) so writes are not blocked. - Renames and drops are two-phase: deploy code that tolerates both shapes, then drop the old column in a later migration once nothing reads it.
Zero-downtime checklist
- Additive change (new column/table/index) — safe.
- Deploy application code that writes both old and new.
- Backfill existing rows in batches.
- Switch reads to the new shape.
- Remove the old shape in a follow-up migration.
Anti-patterns
ALTER TABLE ... SET NOT NULLon a populated column in the same migration that adds it, with no default — it rewrites and locks the table.- Destructive
DROP/TRUNCATEwith no reversible path and no backup step.
04 同仓库更多 Skills
vuejs-state-management
Manage Vue application state with Pinia and the right state locality
★ 2
vuejs-composition-api
Write Vue 3 components with the Composition API, script setup, and composables
★ 2
reactjs-hooks
Use React hooks correctly — dependencies, effects, and custom hooks
★ 2
reactjs-component-design
Write small, composable React components with clean props and no needless state
★ 2
postgres-query-performance
Diagnose and fix slow PostgreSQL queries with indexes and EXPLAIN
★ 2
nx-task-running
Run Nx tasks efficiently with affected, caching, and target dependencies
★ 2