pub trait MigrationHarness<DB: Backend> {
    fn run_migration(
        &mut self,
        migration: &dyn Migration<DB>
    ) -> Result<MigrationVersion<'static>>; fn revert_migration(
        &mut self,
        migration: &dyn Migration<DB>
    ) -> Result<MigrationVersion<'static>>; fn applied_migrations(&mut self) -> Result<Vec<MigrationVersion<'static>>>; fn has_pending_migration<S: MigrationSource<DB>>(
        &mut self,
        source: S
    ) -> Result<bool> { ... } fn run_pending_migrations<S: MigrationSource<DB>>(
        &mut self,
        source: S
    ) -> Result<Vec<MigrationVersion<'_>>> { ... } fn run_next_migration<S: MigrationSource<DB>>(
        &mut self,
        source: S
    ) -> Result<MigrationVersion<'_>> { ... } fn revert_all_migrations<S: MigrationSource<DB>>(
        &mut self,
        source: S
    ) -> Result<Vec<MigrationVersion<'_>>> { ... } fn revert_last_migration<S: MigrationSource<DB>>(
        &mut self,
        source: S
    ) -> Result<MigrationVersion<'static>> { ... } fn pending_migrations<S: MigrationSource<DB>>(
        &mut self,
        source: S
    ) -> Result<Vec<Box<dyn Migration<DB>>>> { ... } }
Expand description

A migration harness is an entity which applies migration to an existing database

Required Methods

Apply a single migration

Types implementing this trait should call Migration::run internally and record that a specific migration version was executed afterwards.

Revert a single migration

Types implementing this trait should call Migration::revert internally and record that a specific migration version was reverted afterwards.

Get a list of already applied migration versions

Provided Methods

Checks if the database represented by the current harness has unapplied migrations

Execute all unapplied migrations for a given migration source

Execute the next migration from the given migration source

Revert all applied migrations from a given migration source

Revert the last migration from a given migration source

This method returns a error if the given migration source does not contain the last applied migration

Get a list of non applied migrations for a specific migration source

The returned migration list is sorted in ascending order by the individual version of each migration

Implementors