Merge pull request #236 from BeaudanBrown/fix-database-bug

Fix windows database crash
pull/239/head
sachaaaaa 6 years ago committed by GitHub
commit 01577a7b45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -679,13 +679,21 @@ async function initialize({ configDir, key }) {
// console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail);
// });
await setupSQLCipher(promisified, { key });
await updateSchema(promisified);
try {
await setupSQLCipher(promisified, { key });
await updateSchema(promisified);
} catch (e) {
await promisified.close();
throw e;
}
db = promisified;
}
async function close() {
if (!db) {
return;
}
const dbRef = db;
db = null;
await dbRef.close();

@ -751,7 +751,7 @@ function getDefaultSQLKey() {
async function removeDB() {
const userDir = await getRealPath(app.getPath('userData'));
sql.removeDB(userDir);
await sql.removeDB(userDir);
try {
userConfig.remove();

Loading…
Cancel
Save