Skip to content
Snippets Groups Projects
Commit d00a5f73 authored by steve-e's avatar steve-e
Browse files

Create index on the logs table on time instead of on kind.

That way we can search through all logs in constant time instead of having to perform a full table scan.
parent 54ad65c7
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,7 @@ def create_log_db():
subject TEXT
);
CREATE INDEX idx_logs_jid_id_kind ON logs (jid_id, kind);
CREATE INDEX idx_logs_jid_id_time ON logs (jid_id, time DESC);
CREATE TABLE caps_cache (
hash_method TEXT,
......
......@@ -27,7 +27,7 @@
basedir = '../'
localedir = '../po'
version = '0.13.10.0-dev'
version = '0.13.10.1-dev'
import sys, os.path
for base in ('.', 'common'):
......
......@@ -214,6 +214,8 @@ def update_config(self, old_version, new_version):
self.update_config_to_01258()
if old < [0, 13, 10, 0] and new >= [0, 13, 10, 0]:
self.update_config_to_013100()
if old < [0, 13, 10, 1] and new >= [0, 13, 10, 1]:
self.update_config_to_013101()
gajim.logger.init_vars()
gajim.config.set('version', new_version)
......@@ -857,4 +859,25 @@ def update_config_to_013100(self):
con.close()
gajim.config.set('version', '0.13.10.0')
def update_config_to_013101(self):
back = os.getcwd()
os.chdir(logger.LOG_DB_FOLDER)
con = sqlite.connect(logger.LOG_DB_FILE)
os.chdir(back)
cur = con.cursor()
try:
cur.executescript(
'''
DROP INDEX IF EXISTS idx_logs_jid_id_kind;
CREATE INDEX IF NOT EXISTS
idx_logs_jid_id_time ON logs (jid_id, time DESC);
'''
)
con.commit()
except sqlite.OperationalError:
pass
con.close()
gajim.config.set('version', '0.13.10.1')
# vim: se ts=3:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment