Merge branch 'master' into logging

This commit is contained in:
Andreas Brett 2021-11-29 20:32:42 +01:00 committed by GitHub
commit a13bdaac84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 3867 additions and 3497 deletions

View file

@ -52,6 +52,7 @@ class Database {
"patch-http-monitor-method-body-and-headers.sql": true,
"patch-2fa-invalidate-used-token.sql": true,
"patch-notification_sent_history.sql": true,
"patch-monitor-basic-auth.sql": true,
}
/**
@ -79,7 +80,7 @@ class Database {
log_info("db", `Data Dir: ${Database.dataDir}`);
}
static async connect() {
static async connect(testMode = false) {
const acquireConnectionTimeout = 120 * 1000;
const Dialect = require("knex/lib/dialects/sqlite3/index.js");
@ -112,8 +113,13 @@ class Database {
await R.autoloadModels("./server/model");
await R.exec("PRAGMA foreign_keys = ON");
// Change to WAL
await R.exec("PRAGMA journal_mode = WAL");
if (testMode) {
// Change to MEMORY
await R.exec("PRAGMA journal_mode = MEMORY");
} else {
// Change to WAL
await R.exec("PRAGMA journal_mode = WAL");
}
await R.exec("PRAGMA cache_size = -12000");
await R.exec("PRAGMA auto_vacuum = FULL");