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