refactor: relationship model to column lists for compound FK (ADR-0043)

Move the FK column fields String->Vec<String> through all six
layers (AddRelationship/SqlForeignKey AST, RelationshipSchema,
metadata, project.yaml, ReadForeignKey, RelationshipEnd). Metadata
stores comma-joined lists in the existing TEXT cells; project.yaml
endpoints now columns: [a, b] (house style). Executor logic is
multi-column ready: resolve_fk_parent_columns (full-PK F-A +
auto-expand F-D), per-pair type-compat, schema_to_ddl multi-column
emission, pragma FK read grouped by id, auto-name + --create-fk
per-column, multi-column teaching echo. Single-column behaviour
preserved (one-element vecs); all 2181 tests green. The grammar to
parse multi-column input lands next.
This commit is contained in:
claude@clouddev1
2026-06-09 18:25:40 +00:00
parent b688592b4c
commit b14f0199e9
23 changed files with 721 additions and 507 deletions
+6 -2
View File
@@ -245,9 +245,13 @@ pub struct IndexSchema {
pub struct RelationshipSchema {
pub name: String,
pub parent_table: String,
pub parent_column: String,
/// Parent PK column(s); one element for single-column, ordered
/// list for a compound-PK FK (ADR-0043). Paired positionally
/// with `child_columns`.
pub parent_columns: Vec<String>,
pub child_table: String,
pub child_column: String,
/// Child column(s), positionally paired with `parent_columns`.
pub child_columns: Vec<String>,
pub on_delete: ReferentialAction,
pub on_update: ReferentialAction,
}