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>> { ... }
    fn all_migrations(&self) -> Result<Vec<Self::M>> { ... }
    fn unapplied_migrations(
        &self,
        conn: &impl ConnectionMethods
    ) -> Result<Vec<Self::M>> { ... }
    fn last_applied_migration(
        &self,
        conn: &impl ConnectionMethods
    ) -> Result<Option<Self::M>> { ... }
}
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>>

Returns migrations since the given migration.

source

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

Returns all migrations

source

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

Get migrations which have not yet been applied to the database

source

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

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

Implementors§