From 2bcdea79dc9154804b4854901b76858cdf99354d Mon Sep 17 00:00:00 2001
From: ryan <ryannganga13325@gmail.com>
Date: Thu, 20 Feb 2025 15:36:33 +0300
Subject: [PATCH] fead(db): initialize database first

---
 src/main.rs | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main.rs b/src/main.rs
index 1f131f9..08fe02c 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,15 +18,16 @@ async fn main() -> std::io::Result<()> {
     use std::sync::Arc;
     use tokio::sync::Mutex;
     
-
-    // Load configuration
-    let conf = get_configuration(None).await.unwrap();
-    let addr = conf.leptos_options.site_addr;
-
     // Initialize the database
     let db = Database::new("compareware.db").unwrap();
     db.create_schema().await.unwrap(); // Ensure the schema is created
     let db = Arc::new(Mutex::new(db)); // Wrap the database in an Arc<Mutex<T>> for shared state
+    println!("Schema created successfully!");
+    
+    // Load configuration
+    let conf = get_configuration(None).await.unwrap();
+    let addr = conf.leptos_options.site_addr;
+
 
     // Generate the list of routes in your Leptos App
     let routes = generate_route_list(App);