diff --git a/backend/src/main.rs b/backend/src/main.rs index babaf7e..663041e 100644 --- a/backend/src/main.rs +++ b/backend/src/main.rs @@ -6,6 +6,7 @@ use axum::{ use http::{Request, StatusCode}; use serde::{Deserialize, Serialize}; use sqlx::{prelude::FromRow, sqlite::SqlitePoolOptions, SqlitePool}; +use sqlx::migrate::Migrator; use tower_http::services::ServeDir; mod error_handling; @@ -78,6 +79,13 @@ async fn main() { let app_state = AppState {db_pool: db_pool.expect("Failed to get db_pool") }; + static MIGRATOR: Migrator = sqlx::migrate!(); + + MIGRATOR + .run(&app_state.db_pool) + .await + .expect("Failed to run migrations"); + let user_data: Option = None; // build our application with some routes