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
FnMigration
s are provided a ConnConfig
instance and given free rein to do as they please.
Database specific features (d-postgres
/d-sqlite
/d-mysql
) are required to use this functionality.
Fields
tag: String
up: Option<T>
down: Option<U>
Methods
impl<T, U> FnMigration<T, U> where
T: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
U: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
[src]
T: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
U: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
fn with_tag(_tag: &str) -> Result<DatabaseFeatureRequired>
[src]
Create a new FnMigration
with the given tag
Tags may contain [a-z0-9-]
fn up(&mut self, f_up: T) -> &mut Self
[src]
Function to use for up
migrations
Function must have the signature fn(ConnConfig) -> std::result::Result<(), Box<std::error::Error>>
.
fn down(&mut self, f_down: U) -> &mut Self
[src]
Function to use for down
migrations
Function must have the signature fn(ConnConfig) -> std::result::Result<(), Box<std::error::Error>>
.
fn boxed(&self) -> Box<Migratable>
[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]
fn clone(&self) -> FnMigration<T, U>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug, U: Debug> Debug for FnMigration<T, U>
[src]
impl<T, U> Migratable for FnMigration<T, U> where
T: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
U: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
[src]
T: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
U: 'static + Clone + Fn(ConnConfig) -> Result<(), Box<Error>>,
fn apply_up(&self, _: DbKind, config: &Config) -> Result<(), Box<Error>>
[src]
Define functionality that runs for up
migrations
fn apply_down(&self, _: DbKind, config: &Config) -> Result<(), Box<Error>>
[src]
Define functionality that runs for down
migrations
fn tag(&self) -> String
[src]
A unique identifying tag
fn description(&self, _: &Direction) -> String
[src]
Option migration description. Defaults to Migratable::tag