diff --git a/crates/backend/src/main.rs b/crates/backend/src/main.rs index fc72f6f..b779476 100644 --- a/crates/backend/src/main.rs +++ b/crates/backend/src/main.rs @@ -1,4 +1,5 @@ -use actix_web::{web, App, HttpResponse, HttpServer, Responder}; +use actix_web::{web, App, HttpServer}; +use migration::MigratorTrait; use sea_orm::{Database, DatabaseConnection}; use std::env; @@ -24,8 +25,15 @@ async fn main() -> std::io::Result<()> { .await .expect("Connecting to Database failed"); + println!("Running Migrations"); + migration::Migrator::up(&conn, None) + .await + .expect("Running migrations failed"); + println!("Finished running migrations"); + let state = AppState { db: conn }; + println!("Listening for connections..."); HttpServer::new(move || { let cors = if cfg!(debug_assertions) { actix_cors::Cors::permissive() @@ -41,7 +49,3 @@ async fn main() -> std::io::Result<()> { .run() .await } - -async fn index() -> impl Responder { - HttpResponse::Ok().body("API Test Response") -}