Skip to main content

Migration

Trait Migration 

Source
pub trait Migration: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn up<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        schema: &'life1 mut Schema<'life2>,
    ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn down<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _schema: &'life1 mut Schema<'life2>,
    ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
}
Expand description

One migration: a stable name, an up, and an optional down.

Required Methods§

Source

fn name(&self) -> &str

The stable name recorded in the tracking table. Never change it once the migration has shipped.

Source

fn up<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, schema: &'life1 mut Schema<'life2>, ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Applies the migration.

Provided Methods§

Source

fn down<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _schema: &'life1 mut Schema<'life2>, ) -> Pin<Box<dyn Future<Output = CoreResult<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Reverses the migration. The default marks it irreversible; the runner fills in the module id. Override to make a migration reversible.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§