Module sqlx_migrator::migration
source · Expand description
Module defining migration trait To create own implement migration trait for type
§Example
use sqlx_migrator::error::Error;
use sqlx_migrator::migration::Migration;
use sqlx_migrator::operation::Operation;
use sqlx_migrator::sqlx::Sqlite;
struct ExampleMigration;
impl Migration<Sqlite> for ExampleMigration {
fn app(&self) -> &str {
"example"
}
fn name(&self) -> &str {
"first_migration"
}
fn parents(&self) -> Vec<Box<dyn Migration<Sqlite>>> {
vec![]
}
fn operations(&self) -> Vec<Box<dyn Operation<Sqlite>>> {
vec![]
}
fn replaces(&self) -> Vec<Box<dyn Migration<Sqlite>>> {
vec![]
}
fn run_before(&self) -> Vec<Box<dyn Migration<Sqlite>>> {
vec![]
}
fn is_atomic(&self) -> bool {
true
}
}
Structs§
- Migration struct created from sql table. Struct contains 4 fields which maps to
id
,app
,name
,applied_time
sql fields. It is used to list applied migrations
Traits§
- Trait for migration