Struct migrant_lib::migration::FileMigration[][src]

pub struct FileMigration {
    pub tag: String,
    pub up: Option<PathBuf>,
    pub down: Option<PathBuf>,
    // some fields omitted
}

Define a migration that uses SQL statements saved in files.

Note: Files defined in this migration must be present at run-time. File paths can be absolute or relative. Relative file paths are relative to the directory from which the program is run.

Note: SQL statements are batch executed as is. If you want your migration to happen atomically in a transaction you should manually wrap your statements in a transaction (begin transaction; ... commit;).

Fields

tag: Stringup: Option<PathBuf>down: Option<PathBuf>

Implementations

impl FileMigration[src]

pub fn with_tag(tag: &str) -> Self[src]

Create a new FileMigration with a given tag

pub fn up<T: AsRef<Path>>(&mut self, up_file: T) -> Result<&mut Self>[src]

Define the file to use for running up migrations.

Note: Files defined in this migration must be present at run-time. File paths can be absolute or relative. Relative file paths are relative to the directory from which the program is run.

pub fn down<T: AsRef<Path>>(&mut self, down_file: T) -> Result<&mut Self>[src]

Define the file to use for running down migrations.

Note: Files defined in this migration must be present at run-time. File paths can be absolute or relative. Relative file paths are relative to the directory from which the program is run.

pub fn boxed(&self) -> Box<dyn Migratable>[src]

Box this migration up so it can be stored with other migrations

Trait Implementations

impl Clone for FileMigration[src]

impl Debug for FileMigration[src]

impl Migratable for FileMigration[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> From<T> for T[src]

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

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

type Owned = T

The resulting type after obtaining ownership.

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.