#[non_exhaustive]pub enum ColumnEvolution<'a> {
AddColumn {
schema: Option<&'a str>,
table: &'a str,
column: &'a str,
data_type: &'a DataType,
},
WidenColumn {
schema: Option<&'a str>,
table: &'a str,
column: &'a str,
data_type: &'a DataType,
},
AddNestedField {
schema: Option<&'a str>,
table: &'a str,
column: &'a str,
field: &'a str,
data_type: &'a DataType,
},
RequireColumn {
schema: Option<&'a str>,
table: &'a str,
column: &'a str,
data_type: &'a DataType,
},
}Expand description
One change to a table that already holds rows, handed to the dialect to spell.
The schema and table arrive unqualified and unquoted, because the dialect
knows how it qualifies and quotes them. The type arrives as a
DataType — Razeri’s own, so the dialect renders it the way it renders
every other column of that type, and the statement cannot disagree with the
CREATE that would have built the same column.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
AddColumn
A column the table does not have yet, which accepts no value today.
Fields
WidenColumn
A column whose declared type now holds more than it held.
Fields
AddNestedField
A record column that gained a field, and gained nothing else.
Fields
RequireColumn
A column that may no longer be left empty, asked once every row the table holds has a value in it.
A new column a design requires is added without its NOT NULL,
because the rows a table already holds have no value to give it. Once
they do, this is the step that requires it: ALTER TABLE … ALTER COLUMN … SET NOT NULL on some engines, MODIFY … NOT NULL with the
type restated on others. data_type is the column’s type, for an
engine that restates it.