Trait butane::migrations::Migrations
source · 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§
sourcefn get_migration(&self, name: &str) -> Option<Self::M>
fn get_migration(&self, name: &str) -> Option<Self::M>
Gets the migration with the given name, if it exists
Provided Methods§
sourcefn migrations_since(
&self,
since: &Self::M
) -> Result<Vec<Self::M, Global>, Error>
fn migrations_since( &self, since: &Self::M ) -> Result<Vec<Self::M, Global>, Error>
Returns migrations since the given migration.
sourcefn unapplied_migrations(
&self,
conn: &impl ConnectionMethods
) -> Result<Vec<Self::M, Global>, Error>
fn unapplied_migrations( &self, conn: &impl ConnectionMethods ) -> Result<Vec<Self::M, Global>, Error>
Get migrations which have not yet been applied to the database
sourcefn last_applied_migration(
&self,
conn: &impl ConnectionMethods
) -> Result<Option<Self::M>, Error>
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