pub struct ColumnSchema {Show 15 fields
pub name: String,
pub column_type: ColumnType,
pub nullable: bool,
pub default: Option<String>,
pub unique: bool,
pub primary_key: bool,
pub auto_increment: bool,
pub indexed: bool,
pub index_name: Option<String>,
pub max_length: Option<u32>,
pub min_length: Option<u32>,
pub range: Option<RangeConstraint>,
pub soft_delete: bool,
pub renamed_from: Option<String>,
pub dropped: bool,
}Expand description
Represents a database column
Fields§
§name: StringColumn name
column_type: ColumnTypeColumn data type
nullable: boolWhether the column allows NULL values
default: Option<String>Default value expression (SQL string)
unique: boolWhether the column has a unique constraint
primary_key: boolWhether this column is part of the primary key
auto_increment: boolWhether the primary key auto-increments
indexed: boolWhether this column has an index
index_name: Option<String>Index name if indexed
max_length: Option<u32>Max length for string types
min_length: Option<u32>Min length for string types (validation only)
range: Option<RangeConstraint>Range constraints for numeric types (validation only)
soft_delete: boolWhether this is a soft delete marker column
renamed_from: Option<String>For delta migrations: this column was renamed from another
dropped: boolFor delta migrations: this column should be dropped
Implementations§
Source§impl ColumnSchema
impl ColumnSchema
Sourcepub fn new(name: impl Into<String>, column_type: ColumnType) -> Self
pub fn new(name: impl Into<String>, column_type: ColumnType) -> Self
Create a new column with the given name and type
Sourcepub fn primary_key(self, auto_increment: bool) -> Self
pub fn primary_key(self, auto_increment: bool) -> Self
Set as primary key
Sourcepub fn max_length(self, len: u32) -> Self
pub fn max_length(self, len: u32) -> Self
Set max length
Trait Implementations§
Source§impl Clone for ColumnSchema
impl Clone for ColumnSchema
Source§fn clone(&self) -> ColumnSchema
fn clone(&self) -> ColumnSchema
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ColumnSchema
impl Debug for ColumnSchema
Source§impl<'de> Deserialize<'de> for ColumnSchema
impl<'de> Deserialize<'de> for ColumnSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ColumnSchema
impl PartialEq for ColumnSchema
Source§impl Serialize for ColumnSchema
impl Serialize for ColumnSchema
impl Eq for ColumnSchema
impl StructuralPartialEq for ColumnSchema
Auto Trait Implementations§
impl Freeze for ColumnSchema
impl RefUnwindSafe for ColumnSchema
impl Send for ColumnSchema
impl Sync for ColumnSchema
impl Unpin for ColumnSchema
impl UnwindSafe for ColumnSchema
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
Mutably borrows from an owned value. Read more