fix(backup): buang -wal/-shm lama saat restore DB (backup self-contained)
This commit is contained in:
1 parent
a77975ca44
commit
994e3f8d61
1 file changed
+4
@@ -142,6 +142,10 @@ function restoreDatabase(backupFileName) {
|
|||||||
|
|
||||||
// Restore database
|
// Restore database
|
||||||
fs.copyFileSync(backupFilePath, dbPath);
|
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 stats = fs.statSync(dbPath);
|
||||||
const sizeKB = Math.round(stats.size / 1024);
|
const sizeKB = Math.round(stats.size / 1024);
|
||||||
|
|||||||
Reference in new issue
Block a user