pub struct Column { /* private fields */ }Expand description
A column being defined.
Implementations§
Source§impl Column
impl Column
Sourcepub fn nullable(&mut self) -> &mut Self
pub fn nullable(&mut self) -> &mut Self
Allow NULL. Columns are NOT NULL by default, which is the safer default and the opposite of what SQL gives you.
pub fn unique(&mut self) -> &mut Self
pub fn primary(&mut self) -> &mut Self
pub fn index(&mut self) -> &mut Self
Sourcepub fn default(&mut self, value: &str) -> &mut Self
pub fn default(&mut self, value: &str) -> &mut Self
A literal default. Strings are quoted; use Column::default_raw for
an expression such as now().
pub fn default_int(&mut self, value: i64) -> &mut Self
Sourcepub fn default_bool(&mut self, value: bool) -> &mut Self
pub fn default_bool(&mut self, value: bool) -> &mut Self
MySQL and SQL Server store a boolean as a number, so true is written
as 1 where true would not parse.
Sourcepub fn default_now(&mut self) -> &mut Self
pub fn default_now(&mut self) -> &mut Self
Default to the current time, in whatever the database calls it.
Sourcepub fn default_raw(&mut self, expression: &str) -> &mut Self
pub fn default_raw(&mut self, expression: &str) -> &mut Self
A default expression, written verbatim. Only migration authors reach this, never user input.
Sourcepub fn references(&mut self, table: &str, column: &str) -> &mut Self
pub fn references(&mut self, table: &str, column: &str) -> &mut Self
A foreign key to another table’s column.
Sourcepub fn cascade_on_delete(&mut self) -> &mut Self
pub fn cascade_on_delete(&mut self) -> &mut Self
on delete cascade — only meaningful with Column::references.
pub fn null_on_delete(&mut self) -> &mut Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Column
impl RefUnwindSafe for Column
impl Send for Column
impl Sync for Column
impl Unpin for Column
impl UnsafeUnpin for Column
impl UnwindSafe for Column
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