[]Struct oxidizer::migration::Runner

pub struct Runner { /* fields omitted */ }

Struct that represents the entrypoint to run the migrations, an instance of this struct is returned by the embed_migrations! and include_migration_mods! macros. Runner should not need to be instantiated manually

Implementations

impl Runner

pub fn new(migrations: &[Migration]) -> Runner

instantiate a new Runner

pub fn set_target(self, target: Target) -> Runner

set the target version up to which refinery should migrate, Latest migrates to the latest version available Version migrates to a user provided version, a Version with a higher version than the latest will be ignored. by default this is set to Latest

pub fn set_grouped(self, grouped: bool) -> Runner

Set true if all migrations should be grouped and run in a single transaction. by default this is set to false, each migration runs on their own transaction

Note

set_grouped won't probbaly work on MySQL Databases as MySQL lacks support for transactions around schema alteration operations, meaning that if a migration fails to apply you will have to manually unpick the changes in order to try again (it’s impossible to roll back to an earlier point).

pub fn set_abort_divergent(self, abort_divergent: bool) -> Runner

Set true if migration process should abort if divergent migrations are found i.e. applied migrations with the same version but different name or checksum from the ones on the filesystem. by default this is set to true

pub fn set_abort_missing(self, abort_divergent: bool) -> Runner

Set true if migration process should abort if missing migrations are found i.e. applied migrations that are not found on the filesystem, or migrations found on filesystem with a version inferior to the last one applied but not applied. by default this is set to true

pub fn get_last_applied_migration<C>(
    &self,
    conn: &'a mut C
) -> Result<Option<Migration>, Error> where
    C: Migrate

Queries the database for the last applied migration, returns None if there aren't applied Migrations

pub async fn get_last_applied_migration_async<C>(
    &'_ self,
    conn: &'_ mut C
) -> Result<Option<Migration>, Error> where
    C: AsyncMigrate + Send

Queries the database asychronously for the last applied migration, returns None if there aren't applied Migrations

pub fn get_applied_migrations<C>(
    &self,
    conn: &'a mut C
) -> Result<Vec<Migration>, Error> where
    C: Migrate

Queries the database for all previous applied migrations

pub async fn get_applied_migrations_async<C>(
    &'_ self,
    conn: &'_ mut C
) -> Result<Vec<Migration>, Error> where
    C: AsyncMigrate + Send

Queries the database asynchronously for all previous applied migrations

pub fn run<C>(&self, conn: &'a mut C) -> Result<Report, Error> where
    C: Migrate

Runs the Migrations in the supplied database connection

pub async fn run_async<C>(&'_ self, conn: &'_ mut C) -> Result<Report, Error> where
    C: AsyncMigrate + Send

Runs the Migrations asynchronously in the supplied database connection

Auto Trait Implementations

impl RefUnwindSafe for Runner

impl Send for Runner

impl Sync for Runner

impl Unpin for Runner

impl UnwindSafe for Runner

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,