tern_core::runner

Struct Runner

Source
pub struct Runner<C: MigrationContext> { /* private fields */ }
Expand description

Run operations on a set of migrations for the chosen context.

Implementations§

Source§

impl<C> Runner<C>

Source

pub fn new(context: C) -> Self

Source

pub async fn apply_all(&mut self) -> TernResult<Report>

Apply all unapplied migrations.

Source

pub async fn dryrun(&mut self) -> TernResult<Report>

Return the migration set that would be applied by apply_all.

Source

pub async fn list_applied(&mut self) -> TernResult<Report>

List the migrations that have already been applied.

Source

pub async fn init_history(&mut self) -> TernResult<()>

CREATE IF NOT EXISTS the history table.

Source

pub async fn drop_history(&mut self) -> TernResult<()>

DROP the history table.

Source

pub async fn soft_apply( &mut self, from_version: Option<i64>, to_version: Option<i64>, ) -> TernResult<Report>

Run a “soft apply” for the supplied range of migration versions.

This means that the migration will be saved in the history table, but will not have its query applied. This is useful in the case where you want to change migration tables, apply a patch to the current one, migrate from a different migration tool, etc.

If from_version (resp. to_version) is None, this will soft apply starting at the first migration (resp. ending with the last migration).

Auto Trait Implementations§

§

impl<C> Freeze for Runner<C>
where C: Freeze,

§

impl<C> RefUnwindSafe for Runner<C>
where C: RefUnwindSafe,

§

impl<C> Send for Runner<C>

§

impl<C> Sync for Runner<C>

§

impl<C> Unpin for Runner<C>
where C: Unpin,

§

impl<C> UnwindSafe for Runner<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.