mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-22 19:53:48 +08:00
fix(electron): close db before move db file
This commit is contained in:
@@ -269,6 +269,8 @@ export async function moveDBFile(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
db.db.close();
|
||||||
|
|
||||||
if (isLink) {
|
if (isLink) {
|
||||||
// remove the old link to unblock new link
|
// remove the old link to unblock new link
|
||||||
await fs.unlink(db.path);
|
await fs.unlink(db.path);
|
||||||
@@ -278,8 +280,6 @@ export async function moveDBFile(
|
|||||||
overwrite: true,
|
overwrite: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
db.db.close();
|
|
||||||
|
|
||||||
await fs.ensureSymlink(newFilePath, db.path, 'file');
|
await fs.ensureSymlink(newFilePath, db.path, 'file');
|
||||||
logger.info(`openMoveDBFileDialog symlink: ${realpath} -> ${newFilePath}`);
|
logger.info(`openMoveDBFileDialog symlink: ${realpath} -> ${newFilePath}`);
|
||||||
db.reconnectDB();
|
db.reconnectDB();
|
||||||
|
|||||||
Reference in New Issue
Block a user