Struct sqlx_simple_migrator::Migration[][src]

pub struct Migration {
    pub name: String,
    pub up: Vec<String>,
    pub down: Vec<String>,
    pub mode: Mode,
}

A single database migration

Fields

name: Stringup: Vec<String>down: Vec<String>mode: Mode

Implementations

impl Migration[src]

pub fn new(name: &str) -> Self[src]

Create an empty migration. name is used as a unique key to check if the migration has been completed already. If you are using std::file!() make sure to not change your build paths between deployments, or normalize the paths before passing them in as the migration name.

pub fn with_up(self, up: &str) -> Self[src]

Add an “Up” sql statement that is performed when applying the migration

pub fn with_down(self, down: &str) -> Self[src]

Add a “Down” sql statement that is performed when rolling a migration back

pub fn debug(self) -> Self[src]

Mark this migration as executing in debug mode. Will panic if #[cfg(not(debug_assertions))]

pub fn nuclear_debug(self) -> Self[src]

Mark this migration as executing in “nuclear” debug mode, forcing all migrations to-rerun. Will panic if #[cfg(not(debug_assertions))]

pub async fn run_all(
    pool: &PgPool,
    supplied_migrations: Vec<Migration>
) -> Result<(), MigrationError>
[src]

Execute all of the migrations against the PgPool provided.

pub async fn undo_all(
    pool: &PgPool,
    supplied_migrations: Vec<Migration>
) -> Result<(), MigrationError>
[src]

Run the down scripts to undo all the migrations

Trait Implementations

impl Clone for Migration[src]

impl Default for Migration[src]

Auto Trait Implementations

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> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

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

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

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

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>,