pub struct Schema<'a> { /* private fields */ }Expand description
Emits DDL and runs it.
Implementations§
Source§impl<'a> Schema<'a>
impl<'a> Schema<'a>
pub fn new(db: &'a Database) -> Self
Sourcepub async fn create(
&self,
table: &str,
define: impl FnOnce(&mut Table),
) -> Result<()>
pub async fn create( &self, table: &str, define: impl FnOnce(&mut Table), ) -> Result<()>
Create a table.
Sourcepub async fn alter(
&self,
table: &str,
define: impl FnOnce(&mut Table),
) -> Result<()>
pub async fn alter( &self, table: &str, define: impl FnOnce(&mut Table), ) -> Result<()>
Add or drop columns on an existing table.
pub async fn drop(&self, table: &str) -> Result<()>
pub async fn rename(&self, from: &str, to: &str) -> Result<()>
Sourcepub async fn has_table(&self, table: &str) -> Result<bool>
pub async fn has_table(&self, table: &str) -> Result<bool>
Whether a table exists — how the migration runner decides what to do.
pub async fn has_column(&self, table: &str, column: &str) -> Result<bool>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for Schema<'a>
impl<'a> !UnwindSafe for Schema<'a>
impl<'a> Freeze for Schema<'a>
impl<'a> Send for Schema<'a>
impl<'a> Sync for Schema<'a>
impl<'a> Unpin for Schema<'a>
impl<'a> UnsafeUnpin for Schema<'a>
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