fix(backup): buang -wal/-shm lama saat restore DB (backup self-contained)

This commit is contained in:
oxpoe committed 2026-10-12 23:18:04 +07:00
1 parent a77975ca44
commit 994e3f8d61
1 file changed
+4
+4
View File
@@ -142,6 +142,10 @@ function restoreDatabase(backupFileName) {
// Restore database
fs.copyFileSync(backupFilePath, dbPath);
// Buang WAL/SHM lama: backup VACUUM INTO self-contained, WAL lama milik DB sebelumnya
for (const ext of ['-wal', '-shm']) {
try { fs.unlinkSync(dbPath + ext); } catch (e) {}
}
const stats = fs.statSync(dbPath);
const sizeKB = Math.round(stats.size / 1024);