From 3259f279ea1f2a0342b53240d66739ad361014d4 Mon Sep 17 00:00:00 2001
From: bitful-pannul <bitful-pancreas@protonmail.com>
Date: Tue, 10 Dec 2024 21:54:33 +0200
Subject: [PATCH] sqlite: fix faulty db_path

---
 kinode/src/sqlite.rs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kinode/src/sqlite.rs b/kinode/src/sqlite.rs
index ecc08be3..84e778b1 100644
--- a/kinode/src/sqlite.rs
+++ b/kinode/src/sqlite.rs
@@ -83,10 +83,14 @@ impl SqliteState {
 
         fs::create_dir_all(&db_path).await?;
 
-        let db_file_path = format!("{}.db", db);
+        let db_file_path = db_path.join(format!("{}.db", db));
 
         let db_conn = Connection::open(db_file_path)?;
-        let _ = db_conn.execute("PRAGMA journal_mode=WAL", []);
+        let _: String = db_conn.query_row(
+            "PRAGMA journal_mode=WAL", 
+            [], 
+            |row| row.get(0)
+        )?;
 
         self.open_dbs.insert(key, Mutex::new(db_conn));