Struct schemamama::Migrator
[−]
[src]
pub struct Migrator<T: Adapter> { // some fields omitted }
Maintains an ordered collection of migrations to utilize.
Methods
impl<T: Adapter> Migrator<T>
[src]
fn new(adapter: T) -> Migrator<T>
Create a migrator with a given adapter.
fn adapter(&self) -> &T
Get a reference to the adapter.
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.
fn version_registered(&self, version: Version) -> bool
Returns true is a migration with the provided version has been registered.
fn registered_versions(&self) -> BTreeSet<Version>
Returns the set of all registered migration versions.
fn first_version(&self) -> Option<Version>
Returns the lowest version of the registered migrations, or None
if no migrations have
been registered.
fn last_version(&self) -> Option<Version>
Returns the highest version of the registered migrations, or None
if no migrations have
been registered.
fn current_version(&self) -> Result<Option<Version>, Error<T::Error>>
Returns the latest migration version, or None
if no migrations have been recorded.
fn migrated_versions(&self) -> Result<BTreeSet<Version>, Error<T::Error>>
Returns a set of the versions of all of the currently applied migrations.
fn down(&self, to: Option<Version>) -> Result<(), Error<T::Error>>
Rollback to the specified version (exclusive), or rollback to the state before any
registered migrations were applied if None
is specified.
fn up(&self, to: Option<Version>) -> Result<(), Error<T::Error>>
Migrate to the specified version (inclusive).