Skip to content

Commit

Permalink
Backup : When restoring backup, clean DuckDB WAL file before writing …
Browse files Browse the repository at this point in the history
…new file (GladysAssistant#2145)
  • Loading branch information
Pierre-Gilles authored Oct 25, 2024
1 parent e6d4272 commit 68cbddb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion server/lib/gateway/gateway.restoreBackup.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ async function restoreBackup(sqliteBackupFilePath, duckDbBackupFolderPath) {
await new Promise((resolve) => {
db.duckDb.close(() => resolve());
});
// Delete current DuckDB file
// Delete current DuckDB files
const duckDbFilePath = `${this.config.storage.replace('.db', '')}.duckdb`;
const duckDbWalFilePath = `${this.config.storage.replace('.db', '')}.duckdb.wal`;
await fse.remove(duckDbFilePath);
await fse.remove(duckDbWalFilePath);
const duckDb = new duckdb.Database(duckDbFilePath);
const duckDbWriteConnection = duckDb.connect();
const duckDbWriteConnectionAllAsync = promisify(duckDbWriteConnection.all).bind(duckDbWriteConnection);
Expand Down

0 comments on commit 68cbddb

Please sign in to comment.