fix: add multiple access to db

This commit is contained in:
Julien Calixte
2026-02-17 14:01:22 +01:00
parent c84b4c5f97
commit 8e6ac4faa9
2 changed files with 7 additions and 0 deletions

View File

@@ -2,6 +2,13 @@ import { DB } from "https://deno.land/x/sqlite/mod.ts";
import type { Note } from "./note.ts";
export const db = new DB(Deno.env.get("SQLITE_PATH") ?? "notes.db");
try {
const [[journalMode]] = db.query<[string]>("PRAGMA journal_mode=WAL");
db.query("PRAGMA busy_timeout=5000");
console.log(`[db] journal_mode=${journalMode}, busy_timeout=5000`);
} catch (e) {
console.error("[db] failed to set PRAGMAs:", e);
}
export const getNotes = (cursor?: string, limit = 20) => {
const rows = cursor