mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 01:04:05 +00:00
also backup sqlite shm, val file
This commit is contained in:
parent
8f5e5ad944
commit
7ffdb2eb80
1 changed files with 10 additions and 0 deletions
|
@ -69,6 +69,16 @@ class Database {
|
||||||
const backupPath = "./data/kuma.db.bak" + version;
|
const backupPath = "./data/kuma.db.bak" + version;
|
||||||
fs.copyFileSync(Database.path, backupPath);
|
fs.copyFileSync(Database.path, backupPath);
|
||||||
|
|
||||||
|
const shmPath = Database.path + "-shm";
|
||||||
|
if (fs.existsSync(shmPath)) {
|
||||||
|
fs.copyFileSync(shmPath, shmPath + ".bak" + version);
|
||||||
|
}
|
||||||
|
|
||||||
|
const walPath = Database.path + "-wal";
|
||||||
|
if (fs.existsSync(walPath)) {
|
||||||
|
fs.copyFileSync(walPath, walPath + ".bak" + version);
|
||||||
|
}
|
||||||
|
|
||||||
// Try catch anything here, if gone wrong, restore the backup
|
// Try catch anything here, if gone wrong, restore the backup
|
||||||
try {
|
try {
|
||||||
for (let i = version + 1; i <= this.latestVersion; i++) {
|
for (let i = version + 1; i <= this.latestVersion; i++) {
|
||||||
|
|
Loading…
Reference in a new issue