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:
@@ -90,10 +90,7 @@ fn typing_then_submitting_a_dsl_command_emits_execute_action() {
|
||||
&actions,
|
||||
&Command::CreateTable {
|
||||
name: "Customers".to_string(),
|
||||
columns: vec![ColumnSpec {
|
||||
name: "id".to_string(),
|
||||
ty: Type::Serial,
|
||||
}],
|
||||
columns: vec![ColumnSpec::new("id".to_string(), Type::Serial)],
|
||||
primary_key: vec!["id".to_string()],
|
||||
},
|
||||
);
|
||||
@@ -271,10 +268,7 @@ fn create_table_flow_updates_tables_list_and_structure_view() {
|
||||
let actions = submit(&mut app);
|
||||
let expected_cmd = Command::CreateTable {
|
||||
name: "Customers".to_string(),
|
||||
columns: vec![ColumnSpec {
|
||||
name: "id".to_string(),
|
||||
ty: Type::Serial,
|
||||
}],
|
||||
columns: vec![ColumnSpec::new("id".to_string(), Type::Serial)],
|
||||
primary_key: vec!["id".to_string()],
|
||||
};
|
||||
assert_one_execute_dsl(&actions, &expected_cmd);
|
||||
@@ -326,6 +320,10 @@ fn add_column_flow_updates_structure_view() {
|
||||
table: "Customers".to_string(),
|
||||
column: "Name".to_string(),
|
||||
ty: Type::Text,
|
||||
not_null: false,
|
||||
unique: false,
|
||||
default: None,
|
||||
check: None,
|
||||
},
|
||||
);
|
||||
|
||||
@@ -338,6 +336,10 @@ fn add_column_flow_updates_structure_view() {
|
||||
table: "Customers".to_string(),
|
||||
column: "Name".to_string(),
|
||||
ty: Type::Text,
|
||||
not_null: false,
|
||||
unique: false,
|
||||
default: None,
|
||||
check: None,
|
||||
},
|
||||
description: Some(updated.clone()),
|
||||
});
|
||||
@@ -479,6 +481,10 @@ fn add_relationship_flow_shows_inbound_section_on_parent() {
|
||||
table: "Customers".to_string(),
|
||||
column: "extra".to_string(),
|
||||
ty: Type::Text,
|
||||
not_null: false,
|
||||
unique: false,
|
||||
default: None,
|
||||
check: None,
|
||||
},
|
||||
description: Some(customers),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user