Struct migrant_lib::migration::FnMigration [] [src]

pub struct FnMigration<T, U> {
    pub tag: String,
    pub up: Option<T>,
    pub down: Option<U>,
}

Define a programmable migration

FnMigrations have full database access. Database specific features (d-postgres/d-sqlite/d-mysql) are required to use this functionality. A full re-export of database specific crates are available in migrant_lib::types

Fields

Methods

impl<T, U> FnMigration<T, U> where
    T: 'static + Clone + Fn(DbConn) -> Result<(), Box<Error>>,
    U: 'static + Clone + Fn(DbConn) -> Result<(), Box<Error>>, 
[src]

[src]

Create a new FnMigration with the given tag

Tags may contain [a-z0-9-]

[src]

Function to use for up migrations

[src]

Function to use for down migrations

[src]

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

Trait Implementations

impl<T: Clone, U: Clone> Clone for FnMigration<T, U>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Debug, U: Debug> Debug for FnMigration<T, U>
[src]

[src]

Formats the value using the given formatter.

impl<T, U> Migratable for FnMigration<T, U> where
    T: 'static + Clone + Fn(DbConn) -> Result<(), Box<Error>>,
    U: 'static + Clone + Fn(DbConn) -> Result<(), Box<Error>>, 
[src]

[src]

Define functionality that runs for up migrations

[src]

Define functionality that runs for down migrations

[src]

A unique identifying tag

[src]

Option migration description. Defaults to Migratable::tag