pub trait Migration<MigContext>: Send + Sync {
// Required methods
fn version(&self) -> i32;
fn up<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MigContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn down<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MigContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
A migration is a version of a change in the data. It can be a database migration, a file migration, a binary migration, etc. It can be up (upgrade) or down (downgrade / rollback).
Required Methods§
Sourcefn up<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MigContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn up<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MigContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Upgrade the data to the version of the migration.
Sourcefn down<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MigContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn down<'life0, 'life1, 'async_trait>(
&'life0 self,
ctx: &'life1 mut MigContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Downgrade (rollback) the data. Think of it as a rollback / cancel of the current migration.