From 4ce2bd8cd2cb100c45589bab4bc9c10c1db659cb Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 7 Apr 2021 20:16:21 +0200 Subject: [PATCH] Set omemo+openpgp database properties to be the same as main db --- plugins/omemo/src/logic/database.vala | 12 +++++++----- plugins/openpgp/src/database.vala | 8 ++++++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/plugins/omemo/src/logic/database.vala b/plugins/omemo/src/logic/database.vala index 429b5f0b..ec5a0924 100644 --- a/plugins/omemo/src/logic/database.vala +++ b/plugins/omemo/src/logic/database.vala @@ -256,12 +256,14 @@ public class Database : Qlite.Database { session = new SessionTable(this); content_item_meta = new ContentItemMetaTable(this); init({identity_meta, trust, identity, signed_pre_key, pre_key, session, content_item_meta}); + try { - exec("PRAGMA synchronous=0"); - } catch (Error e) { } - try { - exec("PRAGMA secure_delete=1"); - } catch (Error e) { } + exec("PRAGMA journal_mode = WAL"); + exec("PRAGMA synchronous = NORMAL"); + exec("PRAGMA secure_delete = ON"); + } catch (Error e) { + error("Failed to set OMEMO database properties: %s", e.message); + } } public override void migrate(long oldVersion) { diff --git a/plugins/openpgp/src/database.vala b/plugins/openpgp/src/database.vala index 2bda06af..f488078c 100644 --- a/plugins/openpgp/src/database.vala +++ b/plugins/openpgp/src/database.vala @@ -36,6 +36,14 @@ public class Database : Qlite.Database { this.account_setting_table = new AccountSetting(this); this.contact_key_table = new ContactKey(this); init({account_setting_table, contact_key_table}); + + try { + exec("PRAGMA journal_mode = WAL"); + exec("PRAGMA synchronous = NORMAL"); + exec("PRAGMA secure_delete = ON"); + } catch (Error e) { + error("Failed to set OpenPGP database properties: %s", e.message); + } } public void set_contact_key(Jid jid, string key) {