use migrate macro

This commit is contained in:
Joe Ardent 2024-04-15 22:13:08 -07:00
parent 79da5a02a6
commit 7b41e0f91b

View file

@ -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");
} }