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
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/add_relationship.rs
assertion_line: 64
description: "input=\"add 1:n relationship from Customers.id to Orders.\" cursor=49"
expression: "& a"
---
@@ -25,6 +26,11 @@ Assessment {
kind: Identifier,
mode: Both,
},
Candidate {
text: "(",
kind: Punct,
mode: Both,
},
],
selected: None,
},
@@ -52,6 +58,11 @@ Assessment {
kind: Identifier,
mode: Both,
},
Candidate {
text: "(",
kind: Punct,
mode: Both,
},
],
},
),
@@ -1,5 +1,6 @@
---
source: tests/typing_surface/add_relationship.rs
assertion_line: 51
description: "input=\"add 1:n relationship from Customers.\" cursor=36"
expression: "& a"
---
@@ -20,6 +21,11 @@ Assessment {
kind: Identifier,
mode: Both,
},
Candidate {
text: "(",
kind: Punct,
mode: Both,
},
],
selected: None,
},
@@ -42,6 +48,11 @@ Assessment {
kind: Identifier,
mode: Both,
},
Candidate {
text: "(",
kind: Punct,
mode: Both,
},
],
},
),