refactor: ColumnSpec / AddColumn carry constraint fields (ADR-0029 scaffolding)
Expand ColumnSpec and Command::AddColumn with the four ADR-0029 constraint slots (not_null, unique, default, check), all defaulting off; `Database::add_column` now takes a ColumnSpec. No behaviour change — the grammar to set the fields and the DDL to enforce them land in the following commits. Isolated here so those commits stay readable. Adds ColumnSpec::new for the unconstrained case; 110 call sites updated. 1172 tests pass; clippy clean.
This commit is contained in:
@@ -616,6 +616,12 @@ fn build_add(path: &MatchedPath) -> Result<Command, ValidationError> {
|
||||
table: require_ident(path, "table_name")?,
|
||||
column: require_ident(path, "column_name")?,
|
||||
ty,
|
||||
// Constraint suffix is wired in once the
|
||||
// constraint grammar lands (ADR-0029).
|
||||
not_null: false,
|
||||
unique: false,
|
||||
default: None,
|
||||
check: None,
|
||||
})
|
||||
}
|
||||
Some("1") => build_add_relationship(path),
|
||||
@@ -907,10 +913,7 @@ fn build_create_table(path: &MatchedPath) -> Result<Command, ValidationError> {
|
||||
|
||||
let columns = pk_specs
|
||||
.iter()
|
||||
.map(|(n, t)| ColumnSpec {
|
||||
name: n.clone(),
|
||||
ty: *t,
|
||||
})
|
||||
.map(|(n, t)| ColumnSpec::new(n.clone(), *t))
|
||||
.collect();
|
||||
let primary_key = pk_specs.into_iter().map(|(n, _)| n).collect();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user