added database migration and initialization logic to backend, including migration loader and async migration runner

This commit is contained in:
2025-08-05 03:16:36 +02:00
parent 99ef24076e
commit 86b5f83140
8 changed files with 862 additions and 0 deletions

22
backend-rust/src/main.rs Normal file
View File

@@ -0,0 +1,22 @@
use std::path::Path;
mod db;
mod migrations;
#[tokio::main]
async fn main() {
let migrations_folder = String::from("src/migrations");
let db_path = Path::new("owlynews.sqlite3");
let migrations_path = Path::new(&migrations_folder);
match db::initialize_db(&db_path, migrations_path).await {
Ok(_conn) => {
println!("Database initialized successfully");
// Logic goes here
}
Err(e) => {
println!("Error initializing database: {:?}", e);
}
}
}