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:
+22
-3
@@ -32,7 +32,7 @@ use crate::db::{
|
||||
AddColumnResult, ChangeColumnTypeResult, DataResult, Database, DbError, DeleteResult,
|
||||
DropColumnResult, InsertResult, QueryPlan, TableDescription, UpdateResult,
|
||||
};
|
||||
use crate::dsl::Command;
|
||||
use crate::dsl::{Command, ColumnSpec};
|
||||
use crate::dsl::walker::Severity;
|
||||
use crate::event::AppEvent;
|
||||
use crate::project::{
|
||||
@@ -1706,8 +1706,27 @@ async fn execute_command_typed(
|
||||
.drop_table(name, src)
|
||||
.await
|
||||
.map(|()| CommandOutcome::Schema(None)),
|
||||
Command::AddColumn { table, column, ty } => database
|
||||
.add_column(table, column, ty, src)
|
||||
Command::AddColumn {
|
||||
table,
|
||||
column,
|
||||
ty,
|
||||
not_null,
|
||||
unique,
|
||||
default,
|
||||
check,
|
||||
} => database
|
||||
.add_column(
|
||||
table,
|
||||
ColumnSpec {
|
||||
name: column,
|
||||
ty,
|
||||
not_null,
|
||||
unique,
|
||||
default,
|
||||
check,
|
||||
},
|
||||
src,
|
||||
)
|
||||
.await
|
||||
.map(CommandOutcome::AddColumn),
|
||||
Command::DropColumn {
|
||||
|
||||
Reference in New Issue
Block a user