Skip to content

docs(adr): ADR-0009 schema migration story を draft する (#409)#416

Merged
hideyukiMORI merged 1 commit into
mainfrom
docs/409-adr-0009-schema-migrations
May 22, 2026
Merged

docs(adr): ADR-0009 schema migration story を draft する (#409)#416
hideyukiMORI merged 1 commit into
mainfrom
docs/409-adr-0009-schema-migrations

Conversation

@hideyukiMORI
Copy link
Copy Markdown
Owner

評価レポート `REPORT_commercial_feasibility.md` (#401) が「マイグレーション機構の欠如」を 最大の実務懸念 と指摘 → ADR-0005 が deferred とした migration story の trigger 条件 (外部視点 friction 明文化) が満たされた。ADR-0009 として整理。

Decision: Option C 採用

3 options 比較:

Option What Trade-off
A — 外付け Phinx / Liquibase 外部 tool で migration 管理 NeNe schema source と二重管理
B — 版付き `SchemaDefinition` + auto-generated ALTER 完全自動化 rename / type change / backfill のヒューリスティクスが膨大
C — `cli/schemaDiff.php` + operator-applied SQL live DB introspection vs SchemaDefinition の差を ALTER TABLE で出力 (apply は operator) 最小実装、ADR-0005 single source 保持、Phinx を排除しない

採用は Option C。NeNe philosophy (small framework / env-driven / operator-side concerns stay operator-side) と一致。

Initial scope (実装は別 PR)

  • Add column / Add table / Add index → ALTER TABLE 自動生成
  • Drop / type change / rename / constraint changes → CLI が warning、SQL は出さない (operator が hand-write)

Cross-link

  • ADR-0005 Consequences の "Migrations out of scope" に "addressed by ADR-0009" を追記
  • ADR README index に 0009 追加

実装

本 PR は draft のみ。実装 (`cli/schemaDiff.php`) は次の trial / PR で。

Test plan

  • markdown lint pass
  • ADR-0005 cross-link 動作

Closes #409.

評価レポート REPORT_commercial_feasibility.md (PR #401) が「マイグレーション
機構の欠如」を **最大の実務懸念** と指摘。ADR-0005 が deferred とした
migration story の trigger 条件 (外部視点 friction の明文化) が満たされた
ため、ADR-0009 として整理。

### Status: Accepted

3 options を比較:
- A: 外付け Phinx / Liquibase
- B: 版付き SchemaDefinition + auto-generated ALTER TABLE
- C: cli/schemaDiff.php + operator-applied SQL (採用)

採用理由: NeNe philosophy (small framework / env-driven / operator-side
concerns stay operator-side) と一致。ADR-0005 の single source を保つ
(SchemaDefinition::buildTables() を直接読む)。destructive ops の責任を
operator に明示 (rollback fantasy を約束しない)。Phinx を排除しない。

### 初期 scope

- Add column / Add table / Add index は ALTER TABLE 生成
- Drop column / Drop table / Drop index / type change / rename は
  CLI が warning を出すが SQL は出さない (operator 手書き)

### 実装

本 ADR は draft のみ。実装は次の trial / PR で個別。

### Cross-link

ADR-0005 Consequences の "Migrations are out of scope" 文に
"addressed by ADR-0009" の cross-link を追加。
ADR README index に 0009 を追加。

Closes #409.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ADR candidate: schema migration story (ADR-0009?) — commercial feasibility report の最大懸念

1 participant