Files
everything-claude-code/docs/ja-JP/skills/database-migrations/SKILL.md
Claude ec9ace9c54 docs: add native Japanese translation of ECC documentation (ja-JP)
Translate everything-claude-code repository to Japanese including:
- 17 root documentation files
- 60 agent documentation files
- 80 command documentation files
- 99 rule files across 18 language directories (common, angular, arkts, cpp, csharp, dart, fsharp, golang, java, kotlin, perl, php, python, ruby, rust, swift, typescript, web)
- 199 skill documentation files

Total: 455 files translated to Japanese with:
- Consistent terminology glossary applied throughout
- YAML field names preserved in English (name, description, etc.)
- Code blocks and examples untouched (comments translated)
- Markdown structure and relative links preserved
- Professional translation maintaining technical accuracy

This translation expands ECC accessibility to Japanese-speaking developers and teams.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-05-17 02:31:40 -04:00

55 lines
2.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: database-migrations
description: PostgreSQL、MySQL、一般的なORMPrisma、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;
```
詳細についてはドキュメントを参照してください。