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>where
C: MigrationContext,
impl<C> Runner<C>where
C: MigrationContext,
pub fn new(context: C) -> Self
Sourcepub async fn init_history(&mut self) -> TernResult<()>
pub async fn init_history(&mut self) -> TernResult<()>
CREATE IF NOT EXISTS the history table.
Sourcepub async fn drop_history(&mut self) -> TernResult<()>
pub async fn drop_history(&mut self) -> TernResult<()>
DROP the history table.
Sourcepub async fn run_apply(
&mut self,
target_version: Option<i64>,
dryrun: bool,
) -> TernResult<Report>
pub async fn run_apply( &mut self, target_version: Option<i64>, dryrun: bool, ) -> TernResult<Report>
Apply unapplied migrations up to and including the specified version.
If dryrun is true, the report that is returned will show the
unapplied version of each migration, including the query that was built,
from the first unapplied up through target_version. Applying all
unapplied is equivalent to passing None for target_version.
Sourcepub async fn apply_all(&mut self) -> TernResult<Report>
👎Deprecated since 3.1.0: use run_apply_all with dryrun = false
pub async fn apply_all(&mut self) -> TernResult<Report>
run_apply_all with dryrun = falseApply all unapplied migrations.
Sourcepub async fn run_apply_all(&mut self, dryrun: bool) -> TernResult<Report>
pub async fn run_apply_all(&mut self, dryrun: bool) -> TernResult<Report>
Apply all unapplied migrations.
If dryrun is true, the report that is returned will show the
unapplied version of each migration, including the query that was built,
from the first unapplied up through the latest version in the migration
source directory.
Sourcepub async fn list_applied(&mut self) -> TernResult<Report>
pub async fn list_applied(&mut self) -> TernResult<Report>
List the migrations that have already been applied.
pub async fn soft_apply( &mut self, start_version: Option<i64>, target_version: Option<i64>, ) -> TernResult<Report>
start_versionSourcepub async fn run_soft_apply(
&mut self,
target_version: Option<i64>,
dryrun: bool,
) -> TernResult<Report>
pub async fn run_soft_apply( &mut self, target_version: Option<i64>, dryrun: bool, ) -> TernResult<Report>
Run a “soft apply” of the migrations up to and including the specified version.
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 dryrun is true, the report that is returned will show the unapplied
migrations that would be written to the history table as if they had been
applied, including the query that was built but not ran, from the first
unapplied up through target_version.
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more