fix: ensure data dir exists before loading db (#433)
* fix: ensure data dir exists before loading db * Update src/db/db.ts Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
9a8d7a36b9
commit
b5c20778f9
2 changed files with 2 additions and 3 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import { mkdirSync } from "node:fs";
|
||||
import { Database } from "bun:sqlite";
|
||||
|
||||
mkdirSync("./data", { recursive: true });
|
||||
const db = new Database("./data/mydb.sqlite", { create: true });
|
||||
|
||||
if (!db.query("SELECT * FROM sqlite_master WHERE type='table'").get()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue