Trait schemamama::Adapter [] [src]

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

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.

Required Methods

fn current_version(&self) -> Option<Version>

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

fn migrated_versions(&self) -> BTreeSet<Version>

Returns a set of the versions of all of the currently applied migrations. Can panic if necessary.

fn apply_migration(&self, migration: &Self::MigrationType)

Applies the specified migration. Can panic if necessary.

fn revert_migration(&self, migration: &Self::MigrationType)

Reverts the specified migration. Can panic if necessary.

Implementors