pub struct SchemaBuilder { /* private fields */ }Expand description
Basic schema operations for migrations
Implementations§
Source§impl SchemaBuilder
impl SchemaBuilder
Sourcepub fn create_table<F>(&mut self, table_name: &str, callback: F) -> &mut Selfwhere
F: FnOnce(&mut TableBuilder),
pub fn create_table<F>(&mut self, table_name: &str, callback: F) -> &mut Selfwhere
F: FnOnce(&mut TableBuilder),
Create a new table
Sourcepub fn drop_table(&mut self, table_name: &str) -> &mut Self
pub fn drop_table(&mut self, table_name: &str) -> &mut Self
Drop a table
Sourcepub fn add_column(
&mut self,
table_name: &str,
column_name: &str,
column_type: &str,
) -> &mut Self
pub fn add_column( &mut self, table_name: &str, column_name: &str, column_type: &str, ) -> &mut Self
Add a column to existing table
Sourcepub fn drop_column(&mut self, table_name: &str, column_name: &str) -> &mut Self
pub fn drop_column(&mut self, table_name: &str, column_name: &str) -> &mut Self
Drop a column from existing table
Sourcepub fn create_index(
&mut self,
table_name: &str,
column_names: &[&str],
index_name: Option<&str>,
) -> &mut Self
pub fn create_index( &mut self, table_name: &str, column_names: &[&str], index_name: Option<&str>, ) -> &mut Self
Create an index
Sourcepub fn drop_index(&mut self, index_name: &str) -> &mut Self
pub fn drop_index(&mut self, index_name: &str) -> &mut Self
Drop an index
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchemaBuilder
impl RefUnwindSafe for SchemaBuilder
impl Send for SchemaBuilder
impl Sync for SchemaBuilder
impl Unpin for SchemaBuilder
impl UnwindSafe for SchemaBuilder
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more