From fee88b32e33099c4cdbb78cfcba4413a4b2b2a4a Mon Sep 17 00:00:00 2001 From: Louis Lam Date: Wed, 6 Apr 2022 20:48:13 +0800 Subject: [PATCH] Set PRAGMA synchronous = FULL --- server/database.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/database.js b/server/database.js index 156c295bc..3ec406509 100644 --- a/server/database.js +++ b/server/database.js @@ -55,7 +55,6 @@ class Database { "patch-monitor-basic-auth.sql": true, "patch-status-page.sql": true, "patch-proxy.sql": true, - "patch-monitor-expiry-notification.sql": true, } /** @@ -126,6 +125,11 @@ class Database { await R.exec("PRAGMA cache_size = -12000"); await R.exec("PRAGMA auto_vacuum = FULL"); + // This ensures that an operating system crash or power failure will not corrupt the database. + // FULL synchronous is very safe, but it is also slower. + // Read more: https://sqlite.org/pragma.html#pragma_synchronous + await R.exec("PRAGMA synchronous = FULL"); + console.log("SQLite config:"); console.log(await R.getAll("PRAGMA journal_mode")); console.log(await R.getAll("PRAGMA cache_size"));