Trait diesel::migration::Migration

source ·
pub trait Migration<DB: Backend> {
    // Required methods
    fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>;
    fn revert(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>;
    fn metadata(&self) -> &dyn MigrationMetadata;
    fn name(&self) -> &dyn MigrationName;
}
Expand description

Represents a migration that interacts with diesel

Required Methods§

source

fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

Apply this migration

source

fn revert(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

Revert this migration

source

fn metadata(&self) -> &dyn MigrationMetadata

Get a the attached metadata for this migration

source

fn name(&self) -> &dyn MigrationName

Get the name of the current migration

The provided name is used by migration harness to get the version of a migration and to as something to that is displayed and allows user to identify a specific migration

Trait Implementations§

source§

impl<'a, DB: Backend> Migration<DB> for &'a dyn Migration<DB>

source§

fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

Apply this migration
source§

fn revert(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

Revert this migration
source§

fn metadata(&self) -> &dyn MigrationMetadata

Get a the attached metadata for this migration
source§

fn name(&self) -> &dyn MigrationName

Get the name of the current migration Read more
source§

impl<'a, DB: Backend> Migration<DB> for Box<dyn Migration<DB> + 'a>

source§

fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

Apply this migration
source§

fn revert(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

Revert this migration
source§

fn metadata(&self) -> &dyn MigrationMetadata

Get a the attached metadata for this migration
source§

fn name(&self) -> &dyn MigrationName

Get the name of the current migration Read more

Implementations on Foreign Types§

source§

impl<'a, DB: Backend> Migration<DB> for Box<dyn Migration<DB> + 'a>

source§

fn run(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

source§

fn revert(&self, conn: &mut dyn BoxableConnection<DB>) -> Result<()>

source§

fn metadata(&self) -> &dyn MigrationMetadata

source§

fn name(&self) -> &dyn MigrationName

Implementors§

source§

impl<'a, DB: Backend> Migration<DB> for &'a dyn Migration<DB>