From 5ef0585dbd3bfbc09093bc8f24f41e4ae2349c59 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 9 Feb 2023 18:21:23 +0300 Subject: SRMM: better support for group chats in database --- plugins/Dbx_sqlite/src/dbsettings.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'plugins/Dbx_sqlite/src/dbsettings.cpp') diff --git a/plugins/Dbx_sqlite/src/dbsettings.cpp b/plugins/Dbx_sqlite/src/dbsettings.cpp index c4bd196cb4..249a8bc059 100644 --- a/plugins/Dbx_sqlite/src/dbsettings.cpp +++ b/plugins/Dbx_sqlite/src/dbsettings.cpp @@ -59,7 +59,7 @@ void CDbxSQLite::InitSettings() FillContactSettings(); - DBVARIANT dbv; dbv.type = DBVT_BYTE; + DBVARIANT dbv = { DBVT_BYTE }; if (GetContactSetting(0, "Compatibility", "Sqlite", &dbv)) dbv.bVal = 0; @@ -73,8 +73,14 @@ void CDbxSQLite::InitSettings() rc = sqlite3_exec(m_db, "UPDATE events SET is_read=1 WHERE (flags & 6) <> 0;", nullptr, nullptr, nullptr); logError(rc, __FILE__, __LINE__); - dbv.type = DBVT_BYTE; - dbv.dVal = 1; + dbv.bVal = 1; + } + + if (dbv.bVal < 2) { + int rc = sqlite3_exec(m_db, "ALTER TABLE events ADD COLUMN user_id TEXT NULL;", 0, 0, 0); + logError(rc, __FILE__, __LINE__); + + dbv.bVal = 2; WriteContactSetting(0, "Compatibility", "Sqlite", &dbv); } } -- cgit v1.2.3