pub enum Migration<'a> {
Sql {
name: &'a str,
sql: &'a str,
},
Fn {
name: &'a str,
f: fn(&Connection) -> MigrationFuture<'_>,
},
}Expand description
A single migration step. Can be a raw SQL string, an async function, or a file.
Variants§
Implementations§
Source§impl<'a> Migration<'a>
impl<'a> Migration<'a>
Sourcepub const fn up(name: &'a str, sql: &'a str) -> Self
pub const fn up(name: &'a str, sql: &'a str) -> Self
Creates a migration from a raw SQL string.
Sourcepub const fn up_fn(
name: &'a str,
f: fn(&Connection) -> MigrationFuture<'_>,
) -> Self
pub const fn up_fn( name: &'a str, f: fn(&Connection) -> MigrationFuture<'_>, ) -> Self
Creates a migration from a rust function.
The function must take a &Connection and return a MigrationFuture.
Use the up_fn! macro to directly take an async function.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Migration<'a>
impl<'a> RefUnwindSafe for Migration<'a>
impl<'a> Send for Migration<'a>
impl<'a> Sync for Migration<'a>
impl<'a> Unpin for Migration<'a>
impl<'a> UnwindSafe for Migration<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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