Skip to main content

Runner

Struct Runner 

Source
pub struct Runner<'a> { /* private fields */ }
Expand description

Driver around a Connection that knows how to read / write the schema_migrations ledger and apply pending migrations.

Implementations§

Source§

impl<'a> Runner<'a>

Source

pub fn new(conn: &'a Connection) -> Self

Source

pub fn ensure_table(&self) -> Result<()>

Ensure the bookkeeping table exists. Idempotent — safe to call on every CLI invocation.

Source

pub fn status(&self) -> Result<Status>

Snapshot of (applied, pending) migrations vs the ALL registry.

Source

pub fn up(&self, target: Option<&str>) -> Result<Vec<AppliedNow>>

Apply every pending migration in ALL order, up to and including target (or all pending when target is None). Returns the list of migrations actually applied this call (skipped ones are not included).

Source

pub fn apply(&self, id: &str) -> Result<()>

Apply exactly one migration by id (errors if already applied OR not known). Useful when an operator wants strict 1-step control.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Runner<'a>

§

impl<'a> !Send for Runner<'a>

§

impl<'a> !Sync for Runner<'a>

§

impl<'a> !UnwindSafe for Runner<'a>

§

impl<'a> Freeze for Runner<'a>

§

impl<'a> Unpin for Runner<'a>

§

impl<'a> UnsafeUnpin for Runner<'a>

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

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

Source§

fn vzip(self) -> V