use migrate macro
This commit is contained in:
parent
79da5a02a6
commit
7b41e0f91b
1 changed files with 1 additions and 5 deletions
|
@ -1,7 +1,6 @@
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
use sqlx::{
|
use sqlx::{
|
||||||
migrate::Migrator,
|
|
||||||
sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions},
|
sqlite::{SqliteConnectOptions, SqliteJournalMode, SqlitePoolOptions},
|
||||||
SqlitePool,
|
SqlitePool,
|
||||||
};
|
};
|
||||||
|
@ -73,10 +72,7 @@ pub fn get_db_pool() -> SqlitePool {
|
||||||
.build()
|
.build()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let m = Migrator::new(std::path::Path::new("./migrations"));
|
rt.block_on(sqlx::migrate!().run(&pool)).unwrap();
|
||||||
let mut m = rt.block_on(m).unwrap();
|
|
||||||
let m = m.set_locking(false);
|
|
||||||
rt.block_on(m.run(&pool)).unwrap();
|
|
||||||
tracing::info!("Ran migrations");
|
tracing::info!("Ran migrations");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue