Struct db_up::MigrationRunner
source · pub struct MigrationRunner<S, M, E> { /* private fields */ }
Expand description
Struct for running migrations on a database
Implementations§
source§impl<S, M, E> MigrationRunner<S, M, E>where
S: MigrationStore,
M: MigrationStateManager,
E: MigrationExecutor,
impl<S, M, E> MigrationRunner<S, M, E>where S: MigrationStore, M: MigrationStateManager, E: MigrationExecutor,
sourcepub fn new(store: S, state_manager: Arc<M>, executor: Arc<E>) -> Self
pub fn new(store: S, state_manager: Arc<M>, executor: Arc<E>) -> Self
Create a new MigrationRunner
sourcepub async fn migrate(&self) -> Result<Option<u32>>
pub async fn migrate(&self) -> Result<Option<u32>>
Migrate with a separate transaction for each changelog
This will execute each migration inside its own DB transaction. Therefore, if an error occurs and the method returns prematurely, all versions that have been successfully deployed will stay in the database.