From 52827c6add1a506d5de06a3082810e9e144fa56c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Mon, 13 Nov 2017 19:20:11 +0100 Subject: [PATCH] Add new DB table last_archive_message --- gajim/__init__.py | 2 +- gajim/common/check_paths.py | 7 +++++++ gajim/common/optparser.py | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/gajim/__init__.py b/gajim/__init__.py index 7ec45f0fb..9c408dd76 100644 --- a/gajim/__init__.py +++ b/gajim/__init__.py @@ -1,6 +1,6 @@ import subprocess -__version__ = "0.16.11.1" +__version__ = "0.16.11.2" try: node = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True, diff --git a/gajim/common/check_paths.py b/gajim/common/check_paths.py index 602146110..7c18cb99c 100644 --- a/gajim/common/check_paths.py +++ b/gajim/common/check_paths.py @@ -80,6 +80,13 @@ def create_log_db(): marker INTEGER ); + CREATE TABLE last_archive_message( + jid_id INTEGER PRIMARY KEY UNIQUE, + last_mam_id TEXT, + oldest_mam_timestamp TEXT, + last_muc_timestamp TEXT + ); + CREATE INDEX idx_logs_jid_id_time ON logs (jid_id, time DESC); ''' ) diff --git a/gajim/common/optparser.py b/gajim/common/optparser.py index 4afe62762..d6a2ff3b0 100644 --- a/gajim/common/optparser.py +++ b/gajim/common/optparser.py @@ -242,6 +242,8 @@ class OptionsParser: self.update_config_to_016105() if old < [0, 16, 11, 1] and new >= [0, 16, 11, 1]: self.update_config_to_016111() + if old < [0, 16, 11, 2] and new >= [0, 16, 11, 2]: + self.update_config_to_016112() app.logger.init_vars() app.logger.attach_cache_database() @@ -1029,3 +1031,23 @@ class OptionsParser: log.exception('Error') con.close() app.config.set('version', '0.16.11.1') + + def update_config_to_016112(self): + con = sqlite.connect(logger.LOG_DB_PATH) + cur = con.cursor() + try: + cur.executescript( + ''' + CREATE TABLE IF NOT EXISTS last_archive_message( + jid_id INTEGER PRIMARY KEY UNIQUE, + last_mam_id TEXT, + oldest_mam_timestamp TEXT, + last_muc_timestamp TEXT + ); + ''' + ) + con.commit() + except sqlite.OperationalError: + log.exception('Error') + con.close() + app.config.set('version', '0.16.11.2')