pub trait Migration: Sync + Send { // Required method fn up<'life0, 'async_trait>( &'life0 self, env: Env, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn down<'life0, 'async_trait>( &'life0 self, _env: Env, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn get_id(&self) -> &str { ... } }
Runs a migration.
Rollbacks a migration. Since not every migration could be rollbacked and it often happens there is a blank implementation
A status about a migration will be stored in a db collection with the following document id We can pass an id manually otherwise it will be based on the type name so that uniqueness per project is guaranteed out of the box