pub struct Migrator<T: Adapter> { /* private fields */ }
Expand description
Primary schemer type for defining and applying migrations.
Implementations
sourceimpl<T: Adapter> Migrator<T>
impl<T: Adapter> Migrator<T>
sourcepub fn register(
&mut self,
migration: Box<T::MigrationType>
) -> Result<(), MigratorError<T::Error>>
pub fn register(
&mut self,
migration: Box<T::MigrationType>
) -> Result<(), MigratorError<T::Error>>
Register a migration into the dependency graph.
sourcepub fn register_multiple(
&mut self,
migrations: Vec<Box<T::MigrationType>>
) -> Result<(), MigratorError<T::Error>>
pub fn register_multiple(
&mut self,
migrations: Vec<Box<T::MigrationType>>
) -> Result<(), MigratorError<T::Error>>
Register multiple migrations into the dependency graph. The Vec
does
not need to be order by dependency structure.
sourcepub fn up(&mut self, to: Option<Uuid>) -> Result<(), MigratorError<T::Error>>
pub fn up(&mut self, to: Option<Uuid>) -> Result<(), MigratorError<T::Error>>
Apply migrations as necessary to so that the specified migration is applied (inclusive).
If to
is None
, apply all registered migrations.
sourcepub fn down(&mut self, to: Option<Uuid>) -> Result<(), MigratorError<T::Error>>
pub fn down(&mut self, to: Option<Uuid>) -> Result<(), MigratorError<T::Error>>
Revert migrations as necessary so that no migrations dependent on the specified migration are applied. If the specified migration was already applied, it will still be applied.
If to
is None
, revert all applied migrations.
Auto Trait Implementations
impl<T> RefUnwindSafe for Migrator<T> where
T: RefUnwindSafe,
<T as Adapter>::MigrationType: RefUnwindSafe,
impl<T> Send for Migrator<T> where
T: Send,
<T as Adapter>::MigrationType: Send,
impl<T> Sync for Migrator<T> where
T: Sync,
<T as Adapter>::MigrationType: Sync,
impl<T> Unpin for Migrator<T> where
T: Unpin,
impl<T> UnwindSafe for Migrator<T> where
T: UnwindSafe,
<T as Adapter>::MigrationType: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more