sqlite: fix faulty db_path

This commit is contained in:
bitful-pannul 2024-12-10 21:54:33 +02:00
parent 8a5ac51e7b
commit 3259f279ea

View File

@ -83,10 +83,14 @@ impl SqliteState {
fs::create_dir_all(&db_path).await?; 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 = 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)); self.open_dbs.insert(key, Mutex::new(db_conn));