forked from TWS/kalkutago
integrate migrations
This commit is contained in:
parent
c9c12a0ec7
commit
f7e95ea0a8
|
@ -4,9 +4,16 @@ mod error;
|
|||
mod migrator;
|
||||
use error::Result;
|
||||
use sea_orm::Database;
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let db = Database::connect(db::connection_url()).await?;
|
||||
let schema_manager = SchemaManager::new(&db);
|
||||
migrator::Migrator::refresh(&db).await?;
|
||||
assert!(schema_manager.has_table("tracks").await?);
|
||||
assert!(schema_manager.has_table("ticks").await?);
|
||||
assert!(schema_manager.has_table("groups").await?);
|
||||
assert!(schema_manager.has_table("track2groups").await?);
|
||||
Ok(println!("Hello, world! {db:?}"))
|
||||
}
|
||||
|
|
|
@ -10,6 +10,11 @@ pub struct Migrator;
|
|||
#[async_trait::async_trait]
|
||||
impl MigratorTrait for Migrator {
|
||||
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
|
||||
vec![]
|
||||
vec![
|
||||
Box::new(m20230606_000001_create_tracks_table::Migration),
|
||||
Box::new(m20230606_000002_create_ticks_table::Migration),
|
||||
Box::new(m20230606_000003_create_groups_table::Migration),
|
||||
Box::new(m20230606_000004_create_track2groups_table::Migration),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue