added database migration and initialization logic to backend, including migration loader and async migration runner
This commit is contained in:
22
backend-rust/src/main.rs
Normal file
22
backend-rust/src/main.rs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user