@@ -29,10 +29,7 @@ pub async fn execute() -> anyhow::Result<()> {
|
||||
std::env::var("DATABASE_URL").context("DATABASE_URL not set")?;
|
||||
let pool = PgPool::connect(&database_url).await?;
|
||||
|
||||
sqlx::migrate!("../post3/migrations/")
|
||||
.set_locking(false)
|
||||
.run(&pool)
|
||||
.await?;
|
||||
post3::MIGRATOR.run(&pool).await?;
|
||||
|
||||
tracing::info!("database migrations applied");
|
||||
|
||||
|
||||
@@ -44,11 +44,7 @@ impl TestServer {
|
||||
.unwrap();
|
||||
|
||||
// Run migrations
|
||||
sqlx::migrate!("../post3/migrations/")
|
||||
.set_locking(false)
|
||||
.run(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
post3::MIGRATOR.run(&pool).await.unwrap();
|
||||
|
||||
// Clean slate
|
||||
sqlx::query("DELETE FROM upload_parts").execute(&pool).await.unwrap();
|
||||
|
||||
@@ -9,3 +9,6 @@ pub use backend::StorageBackend;
|
||||
pub use error::Post3Error;
|
||||
pub use fs::FilesystemBackend;
|
||||
pub use store::{PostgresBackend, Store};
|
||||
|
||||
/// Embedded database migrations. Run with `MIGRATOR.run(&pool).await`.
|
||||
pub static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!("./migrations");
|
||||
|
||||
Reference in New Issue
Block a user