Trait schemamama::Adapter [] [src]

pub trait Adapter {
    type MigrationType: Migration + ?Sized;
    type Error;
    fn current_version(&self) -> Result<Option<Version>, Self::Error>;
    fn migrated_versions(&self) -> Result<BTreeSet<Version>, Self::Error>;
    fn apply_migration(&self, migration: &Self::MigrationType) -> Result<(), Self::Error>;
    fn revert_migration(&self, migration: &Self::MigrationType) -> Result<(), Self::Error>;
}

Use this trait to connect the migrator to your chosen database technology.

Associated Types

type MigrationType: Migration + ?Sized

An alias to a specific trait that extends Migration. Typically, the aforementioned trait will declare functions that the adapter will use to migrate upwards and downwards.

type Error

An adapter-specific error type that can be returned from any of this trait's methods.

Required Methods

fn current_version(&self) -> Result<Option<Version>, Self::Error>

Returns the latest migration version, or None if no migrations have been recorded.

fn migrated_versions(&self) -> Result<BTreeSet<Version>, Self::Error>

Returns a set of the versions of all of the currently applied migrations.

fn apply_migration(&self, migration: &Self::MigrationType) -> Result<(), Self::Error>

Applies the specified migration.

fn revert_migration(&self, migration: &Self::MigrationType) -> Result<(), Self::Error>

Reverts the specified migration.

Implementors