pub trait Migrations {
    type M: Migration;

    // Required methods
    fn get_migration(&self, name: &str) -> Option<Self::M>;
    fn latest(&self) -> Option<Self::M>;

    // Provided methods
    fn migrations_since(
        &self,
        since: &Self::M
    ) -> Result<Vec<Self::M, Global>, Error> { ... }
    fn all_migrations(&self) -> Result<Vec<Self::M, Global>, Error> { ... }
    fn unapplied_migrations(
        &self,
        conn: &impl ConnectionMethods
    ) -> Result<Vec<Self::M, Global>, Error> { ... }
    fn last_applied_migration(
        &self,
        conn: &impl ConnectionMethods
    ) -> Result<Option<Self::M>, Error> { ... }
}
Expand description

A collection of migrations.

Required Associated Types§

Required Methods§

source

fn get_migration(&self, name: &str) -> Option<Self::M>

Gets the migration with the given name, if it exists

source

fn latest(&self) -> Option<Self::M>

Get the most recent migration (other than current) or None if no migrations have been created.

Provided Methods§

source

fn migrations_since( &self, since: &Self::M ) -> Result<Vec<Self::M, Global>, Error>

Returns migrations since the given migration.

source

fn all_migrations(&self) -> Result<Vec<Self::M, Global>, Error>

Returns all migrations

source

fn unapplied_migrations( &self, conn: &impl ConnectionMethods ) -> Result<Vec<Self::M, Global>, Error>

Get migrations which have not yet been applied to the database

source

fn last_applied_migration( &self, conn: &impl ConnectionMethods ) -> Result<Option<Self::M>, Error>

Get the last migration that has been applied to the database or None if no migrations have been applied

Implementors§