fix(electron): close db before move db file

This commit is contained in:
LongYinan 2023-05-11 14:22:02 +08:00
parent c58673c55f
commit 717dd93f37

View File

@ -269,6 +269,8 @@ export async function moveDBFile(
};
}
db.db.close();
if (isLink) {
// remove the old link to unblock new link
await fs.unlink(db.path);
@ -278,8 +280,6 @@ export async function moveDBFile(
overwrite: true,
});
db.db.close();
await fs.ensureSymlink(newFilePath, db.path, 'file');
logger.info(`openMoveDBFileDialog symlink: ${realpath} -> ${newFilePath}`);
db.reconnectDB();