feat: ADR-0035 4i(a,b) — CREATE TABLE help/usage + describe table constraints; Phase 4 complete
(b) describe shows table-level constraints: TableDescription gains unique_constraints + check_constraints (populated by do_describe_table from read_schema), rendered in a new "Table constraints:" section — composite UNIQUE and table-level CHECK (named + unnamed). The per-column Constraints column already covered single-column NOT NULL/UNIQUE/PK/CHECK. (a) CREATE TABLE help/usage skeleton refreshed for the column DEFAULT/ CHECK/REFERENCES, table-level composite UNIQUE, table CHECK, and table-level FOREIGN KEY forms (4a.2/4a.3/4b) — engine-neutral, vocab-audit clean. With 4i's (c)/(d)/(e) already shipped, this completes sub-phase 4i — the verification sweep — and therefore ADR-0035 Phase 4 (4a–4i). ADR-0035 Status, §13 4i, the ADR index, and requirements.md Q1 updated to "Phase 4 complete". Tests: render_structure table-level-constraints unit test + e2e_describe_shows_table_level_constraints. Full suite 1917 passing / 0 failing / 1 ignored; clippy clean.
This commit is contained in:
@@ -70,6 +70,13 @@ pub struct TableDescription {
|
||||
pub inbound_relationships: Vec<RelationshipEnd>,
|
||||
/// User-created indexes on this table (ADR-0025).
|
||||
pub indexes: Vec<IndexInfo>,
|
||||
/// Table-level composite `UNIQUE (a, b, …)` constraints (ADR-0035
|
||||
/// §4a.2). Single-column UNIQUE rides on the column itself
|
||||
/// (`ColumnDescription::unique`); these are the multi-column ones.
|
||||
pub unique_constraints: Vec<Vec<String>>,
|
||||
/// Table-level `CHECK (…)` constraints with their optional name
|
||||
/// (ADR-0035 §4a.3 / §4g), in declaration order.
|
||||
pub check_constraints: Vec<crate::persistence::TableCheck>,
|
||||
}
|
||||
|
||||
/// One user-created index on a table (ADR-0025).
|
||||
@@ -7390,6 +7397,8 @@ fn do_describe_table(conn: &Connection, name: &str) -> Result<TableDescription,
|
||||
outbound_relationships,
|
||||
inbound_relationships,
|
||||
indexes,
|
||||
unique_constraints: schema.unique_constraints.clone(),
|
||||
check_constraints: schema.check_constraints,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user