pub struct ColumnDef {
pub name: &'static str,
pub data_type: DataTypeKind,
pub auto_increment: bool,
pub nullable: bool,
pub primary_key: bool,
pub unique: bool,
pub foreign_key: Option<ForeignKeyDef>,
pub default: Option<fn() -> Value>,
pub renamed_from: &'static [&'static str],
}Expand description
Defines a column in a database table.
Fields§
§name: &'static strThe name of the column.
data_type: DataTypeKindThe data type of the column.
auto_increment: boolIndicates if this column is auto-incrementing (applicable for integer types).
Cannot be nullable.
nullable: boolIndicates if this column can contain NULL values.
primary_key: boolIndicates if this column is part of the primary key.
unique: boolIndicates if this column has unique values across all records.
foreign_key: Option<ForeignKeyDef>Foreign key definition, if any.
default: Option<fn() -> Value>Default value constructor, if any.
Populated by the #[default = ...] attribute on a #[derive(Table)]
field. Consumed by the migration planner when adding a non-nullable
column to satisfy the
DefaultMissing
check.
renamed_from: &'static [&'static str]Previous names this column was known by, in chronological order.
Populated by the #[renamed_from("old1", "old2", ...)] attribute. The
migration planner walks this list to detect a RenameColumn op when a
stored column with one of these names matches the compiled column.
Trait Implementations§
impl Copy for ColumnDef
impl Eq for ColumnDef
Auto Trait Implementations§
impl Freeze for ColumnDef
impl RefUnwindSafe for ColumnDef
impl Send for ColumnDef
impl Sync for ColumnDef
impl Unpin for ColumnDef
impl UnsafeUnpin for ColumnDef
impl UnwindSafe for ColumnDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.