Add new Columns to Logs.db

This commit is contained in:
Philipp Hörist 2017-03-13 19:33:16 +01:00
parent 55561b3dd0
commit c75c45bc8a
3 changed files with 31 additions and 2 deletions

View File

@ -72,7 +72,12 @@ def create_log_db():
show INTEGER,
message TEXT,
subject TEXT,
additional_data TEXT DEFAULT '{}'
additional_data TEXT DEFAULT '{}',
stanza_id TEXT,
mam_id TEXT,
encryption TEXT,
encryption_state TEXT,
marker INTEGER
);
CREATE INDEX idx_logs_jid_id_time ON logs (jid_id, time DESC);

View File

@ -30,7 +30,7 @@ import os.path
docdir = '../'
basedir = '../'
localedir = '../po'
version = '0.16.10.2'
version = '0.16.10.3'
try:
node = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True,

View File

@ -234,6 +234,8 @@ class OptionsParser:
self.update_config_to_016101()
if old < [0, 16, 10, 2] and new >= [0, 16, 10, 2]:
self.update_config_to_016102()
if old < [0, 16, 10, 3] and new >= [0, 16, 10, 3]:
self.update_config_to_016103()
gajim.logger.init_vars()
gajim.logger.attach_cache_database()
@ -975,3 +977,25 @@ class OptionsParser:
con.close()
gajim.config.set('version', '0.16.10.2')
def update_config_to_016103(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(
'''
ALTER TABLE logs ADD COLUMN 'stanza_id' TEXT;
ALTER TABLE logs ADD COLUMN 'mam_id' TEXT;
ALTER TABLE logs ADD COLUMN 'encryption' TEXT;
ALTER TABLE logs ADD COLUMN 'encryption_state' TEXT;
ALTER TABLE logs ADD COLUMN 'marker' INTEGER;
'''
)
con.commit()
except sqlite.OperationalError:
pass
con.close()
gajim.config.set('version', '0.16.10.3')