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 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) -> Option<Version>
Returns the latest migration version, or None
if no migrations have been recorded.
Panics
Panics if there is an underlying problem retrieving the current version from the adapter.
fn migrated_versions(&self) -> BTreeSet<Version>
Returns a set of the versions of all of the currently applied migrations.
Panics
Panics if there is an underlying problem retrieving the current versions from the adapter.
fn down(&self, to: Option<Version>)
Rollback to the specified version (exclusive), or rollback to the state before any
registered migrations were applied if None
is specified.
Panics
Panics if there is an underlying problem reverting any of the matched migrations.
fn up(&self, to: Version)
Migrate to the specified version (inclusive).
Panics
Panics if there is an underlying problem applying any of the matched migrations.