Migration

Trait Migration 

Source
pub trait Migration: Send + Sync {
    // Required methods
    fn version(&self) -> i64;
    fn name(&self) -> &str;
    fn up(&self, conn: &mut dyn MigrationConnection) -> Result<()>;
    fn down(&self, conn: &mut dyn MigrationConnection) -> Result<()>;

    // Provided method
    fn checksum(&self) -> String { ... }
}
Expand description

Core trait for defining database migrations

Required Methods§

Source

fn version(&self) -> i64

Get the unique version number for this migration

Source

fn name(&self) -> &str

Get the human-readable name for this migration

Source

fn up(&self, conn: &mut dyn MigrationConnection) -> Result<()>

Execute the migration (apply changes)

Source

fn down(&self, conn: &mut dyn MigrationConnection) -> Result<()>

Reverse the migration (rollback changes)

Provided Methods§

Source

fn checksum(&self) -> String

Get the checksum of this migration for verification

Implementors§