pub trait Info<DB> {
// Required methods
fn migrations(&self) -> &Vec<Box<dyn Migration<DB>>>;
fn migrations_mut(&mut self) -> &mut Vec<Box<dyn Migration<DB>>>;
// Provided methods
fn add_migrations(
&mut self,
migrations: Vec<Box<dyn Migration<DB>>>,
) -> Result<(), Error> { ... }
fn add_migration(
&mut self,
migration: Box<dyn Migration<DB>>,
) -> Result<(), Error> { ... }
}
Expand description
The Info
trait provides database-agnostic methods for managing
migrations and interacting with migration states.
Required Methods§
Sourcefn migrations(&self) -> &Vec<Box<dyn Migration<DB>>>
fn migrations(&self) -> &Vec<Box<dyn Migration<DB>>>
Returns a reference to the list of migrations.
Sourcefn migrations_mut(&mut self) -> &mut Vec<Box<dyn Migration<DB>>>
fn migrations_mut(&mut self) -> &mut Vec<Box<dyn Migration<DB>>>
Returns a mutable reference to the list of migrations.
Provided Methods§
Sourcefn add_migrations(
&mut self,
migrations: Vec<Box<dyn Migration<DB>>>,
) -> Result<(), Error>
fn add_migrations( &mut self, migrations: Vec<Box<dyn Migration<DB>>>, ) -> Result<(), Error>
Adds a list of migrations to the migrator.
This method accepts a vector of migrations and adds each one individually to ensure proper handling of migration relationships and duplicates.
§Errors
If migration is added with same app and name but inconsistent value i.e its parents, run before, replaces and is atomic differ and do not have same number of operation
Sourcefn add_migration(
&mut self,
migration: Box<dyn Migration<DB>>,
) -> Result<(), Error>
fn add_migration( &mut self, migration: Box<dyn Migration<DB>>, ) -> Result<(), Error>
Adds a single migration to the migrator.
§Errors
If migration is added with same app and name but inconsistent value i.e its parents, run before, replaces and is atomic differ and do not have same number of operation