feat: ADR-0035 4f — ALTER TABLE … ALTER COLUMN TYPE
Fourth AlterTableAction (AlterColumnType), runtime-decomposed to the existing change_column_type executor with ForceConversion — which IS the §7 advanced policy: lossy converts with a note (no force flag), incompatible + the ADR-0017 static refusals (↔blob, same-type, date↔datetime, non-int→serial) still refuse, while int→serial is allowed (auto-fills nulls + UNIQUE, ADR-0018 §8). No new mode/note/persistence; undo is the advanced safety net. Grammar adds a fourth action branch leading on `alter`, discriminated in the builder by the `type` keyword (unique — ADD COLUMN's type is an ident); the type slot reuses SQL_TYPE. The internal-__rdbms_* guard was folded into do_change_column_type (user-confirmed), closing the simple `change column` exposure. Tests: 7 Tier-3 e2e via run_replay + 4 Tier-1 parse (incl. a column-named- `type` discriminator probe) + the simple-surface guard. Help/usage refreshed; ADR-0035 §13 4f + README + requirements.md in lockstep.
This commit is contained in:
+11
-1
@@ -33,7 +33,7 @@ use crate::db::{
|
||||
Database, DbError, DeleteResult, DropColumnResult, DropIndexOutcome, DropOutcome, InsertResult,
|
||||
QueryPlan, TableDescription, UpdateResult,
|
||||
};
|
||||
use crate::dsl::{AlterTableAction, Command, ColumnSpec};
|
||||
use crate::dsl::{AlterTableAction, ChangeColumnMode, Command, ColumnSpec};
|
||||
use crate::dsl::walker::Severity;
|
||||
use crate::event::AppEvent;
|
||||
use crate::project::{
|
||||
@@ -2114,6 +2114,16 @@ async fn execute_command_typed(
|
||||
.rename_column(table, old, new, src)
|
||||
.await
|
||||
.map(|d| CommandOutcome::Schema(Some(d))),
|
||||
// `ALTER COLUMN … TYPE` reuses the simple `change column`
|
||||
// executor with `ForceConversion` — the ADR-0035 §7
|
||||
// advanced policy (lossy converts with a note; no force
|
||||
// flag; static-refused / incompatible still refuse). The
|
||||
// ChangeColumn outcome surfaces the client-side lossy note,
|
||||
// shared with simple mode.
|
||||
AlterTableAction::AlterColumnType { column, ty } => database
|
||||
.change_column_type(table, column, ty, ChangeColumnMode::ForceConversion, src)
|
||||
.await
|
||||
.map(CommandOutcome::ChangeColumn),
|
||||
},
|
||||
Command::AddConstraint {
|
||||
table,
|
||||
|
||||
Reference in New Issue
Block a user