Make WAL pragma optional for readonly deployments

This commit is contained in:
Oliver 2026-02-16 07:48:16 +01:00
parent e67d8ad0f5
commit d580a4ac82
No known key found for this signature in database

View file

@ -16,7 +16,11 @@ def get_conn() -> sqlite3.Connection:
def init_db() -> None:
DB_PATH.parent.mkdir(parents=True, exist_ok=True)
with get_conn() as conn:
conn.execute("PRAGMA journal_mode = WAL")
try:
conn.execute("PRAGMA journal_mode = WAL")
except sqlite3.OperationalError:
# Some deployments run with read-only db mounts; continue without WAL.
pass
conn.executescript(
"""
CREATE TABLE IF NOT EXISTS spot (