pub struct ColumnDef {Show 14 fields
pub name: String,
pub ty: ColumnTypeName,
pub nullable: bool,
pub default: Option<Expr>,
pub auto_increment: bool,
pub is_primary_key: bool,
pub is_unique: bool,
pub check: Option<Expr>,
pub user_type_ref: Option<String>,
pub on_update_runtime: Option<Expr>,
pub collation: Collation,
pub is_unsigned: bool,
pub inline_enum_variants: Option<Vec<String>>,
pub inline_set_variants: Option<Vec<String>>,
}Fields§
§name: String§ty: ColumnTypeName§nullable: bool§default: Option<Expr>DEFAULT <expr> literal supplied at CREATE TABLE. Engine
evaluates this once (with an empty row) and caches the resulting
Value on the column schema.
auto_increment: boolMySQL-style AUTO_INCREMENT — the engine maintains a counter
per such column and fills the slot when INSERT leaves it
unbound (omitted from a column-list INSERT or explicitly NULL).
is_primary_key: boolv7.9.13 — inline PRIMARY KEY column constraint. mailrs
migration follow-up F1. Implies NOT NULL. Engine creates
an implicit BTree index named <table>_pkey over this
column at CREATE TABLE time, satisfying the parent-side
index requirement for any FOREIGN KEY pointing at it.
is_unique: boolv7.13.0 — inline UNIQUE column constraint
(mailrs round-5 G2). The CREATE TABLE handler folds this
into a single-column TableConstraint::Unique so the
engine path stays uniform with table-level UNIQUE.
check: Option<Expr>v7.13.0 — inline CHECK (<expr>) column constraint
(mailrs round-5 G3). Stored alongside the column so the
CREATE TABLE handler can fold these into table-level
CHECK constraints. Multiple inline CHECKs on the same
column are concatenated with AND at the table level.
user_type_ref: Option<String>v7.17.0 Phase 1.4 — user-defined type reference. When the
parser sees an unknown column-type ident (anything not in
the built-in parse_column_type_name table), it sets
ty = ColumnTypeName::Text and records the original name
here. The engine resolves at CREATE TABLE time: if a
catalog enum/domain with this name exists, the column is
bound to it (label-checked on INSERT for enums; CHECK-
constrained for domains); otherwise the CREATE TABLE
errors with “unknown type”.
on_update_runtime: Option<Expr>v7.17.0 Phase 2.1 — MySQL-style ON UPDATE CURRENT_TIMESTAMP column attribute. When set, an
UPDATE that does NOT explicitly bind this column
overrides the new value with now() (engine clock).
Pre-v7.17 SPG silently accepted the syntax and never
fired the override — updated_at columns from mysqldump
stayed pinned at their initial DEFAULT forever, an
audit Tier-S silent-failure. Generalised as a stored
expression source so future shapes (ON UPDATE CURRENT_TIMESTAMP(6), ON UPDATE LOCALTIMESTAMP) reuse
the same field; v7.17 only accepts CURRENT_TIMESTAMP.
collation: Collationv7.17.0 Phase 2.5 — text collation derived from the
post-fix COLLATE <name> clause (and / or the table-level
COLLATE=<name> for MySQL dumps that don’t repeat it
per column). Pre-2.5 SPG accepted the clause and
discarded the name, leaving every column byte-compared
— a Tier-S silent failure when the customer expected
_ci / case_insensitive semantics. Parser normalises
the raw collation name into the variants in Collation.
Default Binary preserves the legacy compare path.
is_unsigned: boolv7.17.0 Phase 4.4 — MySQL UNSIGNED modifier flag. Pre-
4.4 SPG accepted and discarded the keyword, leaving
negative values silently accepted on a column the
customer declared INT UNSIGNED NOT NULL. Now: the engine
rejects negative INSERT / UPDATE values on UNSIGNED int
columns. SPG widening to u64-shaped storage is out of
v7.17 scope; the upper bound remains the signed-type max
(i64::MAX for BIGINT UNSIGNED), which still strictly
exceeds what every mailrs / Rails app actually uses.
inline_enum_variants: Option<Vec<String>>v7.17.0 Phase 3.P0-36 — MySQL inline ENUM('a','b','c')
value list captured at parse time. When Some, the parser
recognised ENUM(...) in the type slot; the engine
validates INSERT cells against this list at
column_def_to_schema time and persists the variants on
ColumnSchema.inline_enum_variants. None for all
non-ENUM columns.
inline_set_variants: Option<Vec<String>>v7.17.0 Phase 3.P0-37 — MySQL inline SET('a','b','c')
value list. Distinct from ENUM (subset semantics rather
than pick-one). None for all non-SET columns.