From 9cfec4fa27529cf67072295923813da5061bf17f Mon Sep 17 00:00:00 2001 From: phoenix Date: Thu, 3 Apr 2025 15:21:13 -0400 Subject: [PATCH] Integrated migrations --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 3e254b3..a079bca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -37,6 +37,13 @@ async fn app() -> Router { .await .expect("Failed to create pool"); + // Run migrations using the sqlx::migrate! macro + // Assumes your migrations are in a ./migrations folder relative to Cargo.toml + sqlx::migrate!("./migrations") + .run(&pool) + .await + .expect("Failed to run migrations on testcontainer DB"); + routes().await.layer(axum::Extension(pool)) }