mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Present 'database error' dialog in more situations
This commit is contained in:
parent
812f895e12
commit
ca5132f712
1 changed files with 18 additions and 18 deletions
36
app/sql.js
36
app/sql.js
|
@ -696,25 +696,25 @@ async function initialize({ configDir, key, messages }) {
|
||||||
|
|
||||||
filePath = path.join(dbDir, 'db.sqlite');
|
filePath = path.join(dbDir, 'db.sqlite');
|
||||||
|
|
||||||
const sqlInstance = await openDatabase(filePath);
|
|
||||||
const promisified = promisify(sqlInstance);
|
|
||||||
|
|
||||||
// promisified.on('trace', async statement => {
|
|
||||||
// if (!db || statement.startsWith('--')) {
|
|
||||||
// console._log(statement);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// const data = await db.get(`EXPLAIN QUERY PLAN ${statement}`);
|
|
||||||
// console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail);
|
|
||||||
// });
|
|
||||||
|
|
||||||
await setupSQLCipher(promisified, { key });
|
|
||||||
await updateSchema(promisified);
|
|
||||||
|
|
||||||
db = promisified;
|
|
||||||
|
|
||||||
// test database
|
|
||||||
try {
|
try {
|
||||||
|
const sqlInstance = await openDatabase(filePath);
|
||||||
|
const promisified = promisify(sqlInstance);
|
||||||
|
|
||||||
|
// promisified.on('trace', async statement => {
|
||||||
|
// if (!db || statement.startsWith('--')) {
|
||||||
|
// console._log(statement);
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
// const data = await db.get(`EXPLAIN QUERY PLAN ${statement}`);
|
||||||
|
// console._log(`EXPLAIN QUERY PLAN ${statement}\n`, data && data.detail);
|
||||||
|
// });
|
||||||
|
|
||||||
|
await setupSQLCipher(promisified, { key });
|
||||||
|
await updateSchema(promisified);
|
||||||
|
|
||||||
|
db = promisified;
|
||||||
|
|
||||||
|
// test database
|
||||||
await getMessageCount();
|
await getMessageCount();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('Database startup error:', error.stack);
|
console.log('Database startup error:', error.stack);
|
||||||
|
|
Loading…
Reference in a new issue