Enable WAL

This commit is contained in:
Marcin Czop 2025-01-30 05:34:32 +01:00
parent 05fae4285d
commit cf635e6f7c
No known key found for this signature in database
GPG key ID: 44BCC84471234D0D

View file

@ -2,3 +2,4 @@ import { Database } from "jsr:@db/sqlite@0.12.0";
export const db = await new Database(Deno.env.get("DB_PATH") || "./neomap.sqlite"); export const db = await new Database(Deno.env.get("DB_PATH") || "./neomap.sqlite");
db.prepare("CREATE TABLE IF NOT EXISTS hexes (hex_id TEXT PRIMARY KEY NOT NULL CHECK(hex_id GLOB '[0-9a-f]*'), wifi INTEGER DEFAULT 0 NOT NULL, gsm INTEGER DEFAULT 0 NOT NULL, wcdma INTEGER DEFAULT 0 NOT NULL, lte INTEGER DEFAULT 0 NOT NULL, ble INTEGER DEFAULT 0 NOT NULL, created_at INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL, last_update INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL);").run(); db.prepare("CREATE TABLE IF NOT EXISTS hexes (hex_id TEXT PRIMARY KEY NOT NULL CHECK(hex_id GLOB '[0-9a-f]*'), wifi INTEGER DEFAULT 0 NOT NULL, gsm INTEGER DEFAULT 0 NOT NULL, wcdma INTEGER DEFAULT 0 NOT NULL, lte INTEGER DEFAULT 0 NOT NULL, ble INTEGER DEFAULT 0 NOT NULL, created_at INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL, last_update INTEGER DEFAULT (strftime('%s', 'now')) NOT NULL);").run();
db.exec("pragma journal_mode = WAL");