Trait Migration

Source
pub trait Migration<DB: Database>: Send + Sync {
    // Required methods
    fn version(&self) -> i64;
    fn name(&self) -> &str;
    fn up<'a, 'async_trait>(
        &'a self,
        conn: &'a mut <DB as Database>::Connection,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
    fn down<'a, 'async_trait>(
        &'a self,
        conn: &'a mut <DB as Database>::Connection,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;
}

Required Methods§

Source

fn version(&self) -> i64

Unique version number for ordering migrations

Source

fn name(&self) -> &str

Human readable name of the migration

Source

fn up<'a, 'async_trait>( &'a self, conn: &'a mut <DB as Database>::Connection, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Execute the migration

Source

fn down<'a, 'async_trait>( &'a self, conn: &'a mut <DB as Database>::Connection, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Rollback the migration

Implementors§