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:
+6
-8
@@ -2209,10 +2209,7 @@ mod tests {
|
||||
command,
|
||||
&Command::CreateTable {
|
||||
name: "Customers".to_string(),
|
||||
columns: vec![crate::dsl::ColumnSpec {
|
||||
name: "id".to_string(),
|
||||
ty: Type::Serial,
|
||||
}],
|
||||
columns: vec![crate::dsl::ColumnSpec::new("id", Type::Serial)],
|
||||
primary_key: vec!["id".to_string()],
|
||||
},
|
||||
);
|
||||
@@ -2419,10 +2416,7 @@ mod tests {
|
||||
let mut app = App::new();
|
||||
let cmd = Command::CreateTable {
|
||||
name: "Customers".to_string(),
|
||||
columns: vec![crate::dsl::ColumnSpec {
|
||||
name: "id".to_string(),
|
||||
ty: Type::Serial,
|
||||
}],
|
||||
columns: vec![crate::dsl::ColumnSpec::new("id", Type::Serial)],
|
||||
primary_key: vec!["id".to_string()],
|
||||
};
|
||||
let desc = sample_description("Customers");
|
||||
@@ -3174,6 +3168,10 @@ mod tests {
|
||||
table: "T".to_string(),
|
||||
column: "Name".to_string(),
|
||||
ty: Type::Text,
|
||||
not_null: false,
|
||||
unique: false,
|
||||
default: None,
|
||||
check: None,
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user