feat: fix migrations

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2026-02-27 11:52:29 +01:00
parent aca2cb7f40
commit 1182b9c243
3 changed files with 5 additions and 9 deletions

View File

@@ -29,10 +29,7 @@ pub async fn execute() -> anyhow::Result<()> {
std::env::var("DATABASE_URL").context("DATABASE_URL not set")?; std::env::var("DATABASE_URL").context("DATABASE_URL not set")?;
let pool = PgPool::connect(&database_url).await?; let pool = PgPool::connect(&database_url).await?;
sqlx::migrate!("../post3/migrations/") post3::MIGRATOR.run(&pool).await?;
.set_locking(false)
.run(&pool)
.await?;
tracing::info!("database migrations applied"); tracing::info!("database migrations applied");

View File

@@ -44,11 +44,7 @@ impl TestServer {
.unwrap(); .unwrap();
// Run migrations // Run migrations
sqlx::migrate!("../post3/migrations/") post3::MIGRATOR.run(&pool).await.unwrap();
.set_locking(false)
.run(&pool)
.await
.unwrap();
// Clean slate // Clean slate
sqlx::query("DELETE FROM upload_parts").execute(&pool).await.unwrap(); sqlx::query("DELETE FROM upload_parts").execute(&pool).await.unwrap();

View File

@@ -9,3 +9,6 @@ pub use backend::StorageBackend;
pub use error::Post3Error; pub use error::Post3Error;
pub use fs::FilesystemBackend; pub use fs::FilesystemBackend;
pub use store::{PostgresBackend, Store}; pub use store::{PostgresBackend, Store};
/// Embedded database migrations. Run with `MIGRATOR.run(&pool).await`.
pub static MIGRATOR: sqlx::migrate::Migrator = sqlx::migrate!("./migrations");