mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-22 14:30:58 -04:00
Merge branch 'master' into logging
This commit is contained in:
commit
a13bdaac84
39 changed files with 3867 additions and 3497 deletions
|
@ -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");
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue