pub struct Migrator { /* private fields */ }Expand description
Runs, inspects and rolls back migrations on a single connection.
Implementations§
Source§impl Migrator
impl Migrator
Sourcepub fn new(conn: Connection, migrations: Vec<Registered>) -> Result<Self>
pub fn new(conn: Connection, migrations: Vec<Registered>) -> Result<Self>
Creates a migrator for migrations, which are run in name order.
pub fn connection(&self) -> &Connection
Sourcepub async fn run(&mut self) -> Result<RunReport>
pub async fn run(&mut self) -> Result<RunReport>
Applies every pending migration, in order, as a new batch.
Stops at the first failure; migrations applied before it stay applied.
Sourcepub async fn rollback(&mut self) -> Result<RollbackReport>
pub async fn rollback(&mut self) -> Result<RollbackReport>
Reverts the most recent batch, newest migration first.
Refuses (changing nothing) if any migration in the batch is irreversible or no longer registered.
Auto Trait Implementations§
impl !RefUnwindSafe for Migrator
impl !UnwindSafe for Migrator
impl Freeze for Migrator
impl Send for Migrator
impl Sync for Migrator
impl Unpin for Migrator
impl UnsafeUnpin for Migrator
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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