pub struct Migrator<T: Adapter> { /* private fields */ }
Expand description
Maintains an ordered collection of migrations to utilize.
Implementations§
Source§impl<T: Adapter> Migrator<T>
impl<T: Adapter> Migrator<T>
Sourcepub fn register(&mut self, migration: Box<T::MigrationType>)
pub fn register(&mut self, migration: Box<T::MigrationType>)
Register a migration. If a migration with the same version is already registered, a warning is logged and the registration fails.
Sourcepub fn version_registered(&self, version: Version) -> bool
pub fn version_registered(&self, version: Version) -> bool
Returns true is a migration with the provided version has been registered.
Sourcepub fn registered_versions(&self) -> BTreeSet<Version>
pub fn registered_versions(&self) -> BTreeSet<Version>
Returns the set of all registered migration versions.
Sourcepub fn first_version(&self) -> Option<Version>
pub fn first_version(&self) -> Option<Version>
Returns the lowest version of the registered migrations, or None
if no migrations have
been registered.
Sourcepub fn last_version(&self) -> Option<Version>
pub fn last_version(&self) -> Option<Version>
Returns the highest version of the registered migrations, or None
if no migrations have
been registered.
Sourcepub fn current_version(&self) -> Result<Option<Version>, Error<T::Error>>
pub fn current_version(&self) -> Result<Option<Version>, Error<T::Error>>
Returns the latest migration version, or None
if no migrations have been recorded.
Sourcepub fn migrated_versions(&self) -> Result<BTreeSet<Version>, Error<T::Error>>
pub fn migrated_versions(&self) -> Result<BTreeSet<Version>, Error<T::Error>>
Returns a set of the versions of all of the currently applied migrations.
Auto Trait Implementations§
impl<T> Freeze for Migrator<T>where
T: Freeze,
impl<T> RefUnwindSafe for Migrator<T>
impl<T> Send for Migrator<T>
impl<T> Sync for Migrator<T>
impl<T> Unpin for Migrator<T>where
T: Unpin,
impl<T> UnwindSafe for Migrator<T>
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