PostgreSQL、MySQL、一般的なORM(Prisma、Drizzle、Kysely、Django、TypeORM、golang-migrate)全体のスキーマ変更、データマイグレーション、ロールバック、ゼロダウンタイムデプロイメントのためのデータベースマイグレーションベストプラクティス。
Scanned 9/4/2026
Install to Claude Code
npx -y skills add affaan-m/everything-claude-code --skill database-migrations --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Database Migrations?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/affaan-m-database-migrations-23d573eb)More formats (shields.io, HTML) on the badges page.
---
name: database-migrations
description: PostgreSQL、MySQL、一般的なORM(Prisma、Drizzle、Kysely、Django、TypeORM、golang-migrate)全体のスキーマ変更、データマイグレーション、ロールバック、ゼロダウンタイムデプロイメントのためのデータベースマイグレーションベストプラクティス。
origin: ECC
---
# データベースマイグレーションパターン
本番環境システム用の安全で可逆的なデータベーススキーマ変更。
## アクティベーション時期
- データベーステーブルの作成または変更
- 列またはインデックスの追加/削除
- データマイグレーション(バックフィル、変換)の実行
- ゼロダウンタイムスキーマ変更を計画
- 新しいプロジェクト用のマイグレーションツール設定
## コア原則
1. **すべての変更はマイグレーション** — 本番環境データベースを手動で変更しない
2. **マイグレーションは本番環境で前方のみ** — ロールバックは新しい前向きマイグレーション使用
3. **スキーマとデータマイグレーションは分離** — 1つのマイグレーションでDDLとDMLを混ぜない
4. **本番環境サイズのデータに対してマイグレーションをテスト** — 100行で機能するマイグレーション10M上でロックされる場合がある
5. **マイグレーションは展開後は不変** — 本番環境で実行されたマイグレーションを編集しない
## マイグレーション安全チェックリスト
マイグレーションを適用する前に:
- [ ] マイグレーションはUPとDOWNの両方を持つ(または明示的に不可逆としてマーク)
- [ ] 大型テーブルの完全テーブルロックなし(並行操作使用)
- [ ] 新しい列はデフォルトまたはnullable(デフォルトなしでNOT NULLを追加しない)
- [ ] インデックスは並行して作成(既存テーブルのCREATE TABLEでインライン化しない)
- [ ] データバックフィルはスキーマ変更から分離したマイグレーション
- [ ] 本番環境データのコピーに対してテスト
- [ ] ロールバック計画を文書化
## PostgreSQL パターン
### 列を安全に追加
```sql
-- GOOD: Nullable列、ロックなし
ALTER TABLE users ADD COLUMN avatar_url TEXT;
-- GOOD: デフォルト付きの列(Postgres 11+は即座、書き直しなし)
ALTER TABLE users ADD COLUMN is_active BOOLEAN NOT NULL DEFAULT true;
-- BAD: 既存テーブルのデフォルトなしで NOT NULL(完全書き直し必須)
ALTER TABLE users ADD COLUMN is_active BOOLEAN NOT NULL;
```
詳細についてはドキュメントを参照してください。
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!
Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.
**Complete production-ready guide for Google Gemini embeddings API** This skill provides comprehensive coverage of the `gemini-embedding-001` model for generating text embeddings, including SDK usage, REST API patterns, batch processing, RAG integration with Cloudflare Vectorize, and advanced use cases like semantic search and document clustering. ---
Recovers prior coding-agent session context by running `catchup <agent> --since-compact`, which extracts a clean summary of a previous Codex, Claude Code, Antigravity, OpenCode, or Pi Agent session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", or asks to recover/summarize a previous session before continuing. Do NOT use for the current conversation, git history, or any non-agent log.