feat: compound-PK foreign-key references — grammar + tests (ADR-0043)

Multi-column FK parsing on both surfaces: DSL from P.(a, b) to
C.(x, y) (parenthesized endpoint; single bare form unchanged) and
SQL FOREIGN KEY (a, b) REFERENCES P(x, y) incl. bare-reference
auto-expand. consume_fk_reference + the table-level/ALTER FK
parsers collect column lists; the from P. completion now offers
( (snapshots updated). 12 integration tests in
tests/it/compound_fk.rs cover parse (both surfaces), engine-enforced
FK, arity + partial-PK + per-pair-type-mismatch refusal,
--create-fk per-column, save->rebuild round-trip, undo (one step),
and single-column preservation. Mark T3 [x]; ADR-0043 implemented.
This commit is contained in:
claude@clouddev1
2026-06-09 18:44:37 +00:00
parent b14f0199e9
commit 4752ba29a0
9 changed files with 737 additions and 81 deletions
@@ -2,8 +2,17 @@
## Status
**Accepted** — 2026-06-09. All four genuine forks confirmed by the
user at the recommended option: **F-A** full PK in order, **F-B**
**Accepted + implemented** — 2026-06-09. Implementation landed the
same day: the relationship model went list-based through all six
layers (refactor commit `b14f019`, single-column preserved), then
the DSL + SQL grammars gained multi-column parsing and the
executor the full-PK/auto-expand/per-pair-type-compat/auto-name/
`--create-fk`-per-column logic. Verified by 12 integration tests in
`tests/it/compound_fk.rs` (parse both surfaces, engine-enforced FK,
arity + partial-PK refusal, `--create-fk`, single-column
preserved) on top of the existing single-column relationship
suite. `requirements.md` **T3** is `[x]`. All four genuine forks
confirmed by the user at the recommended option: **F-A** full PK in order, **F-B**
house-style uniform column lists (no migration; back-compat not
required), **F-C** parenthesized DSL lists, **F-D** bare table-level
SQL FK auto-expands to the parent's full PK. Closes the one open