diff --git a/.gitignore b/.gitignore index ff38fa90..b643d7da 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,8 @@ dist/ # Development .notes .*keys.db +*.db-shm +*.db-wal .*wallet.sqlite3 *models.json .cashu diff --git a/routstr/core/db.py b/routstr/core/db.py index 9f886791..6bc3bd90 100644 --- a/routstr/core/db.py +++ b/routstr/core/db.py @@ -79,6 +79,8 @@ async def balances_for_mint_and_unit( async def init_db() -> None: """Initializes the database and creates tables if they don't exist.""" async with engine.begin() as conn: + if DATABASE_URL.startswith("sqlite"): + await conn.exec_driver_sql("PRAGMA journal_mode=WAL") await conn.run_sync(SQLModel.metadata.create_all)