diff options
author | George Hazan <ghazan@miranda.im> | 2023-02-09 18:21:23 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2023-02-09 18:22:12 +0300 |
commit | 5ef0585dbd3bfbc09093bc8f24f41e4ae2349c59 (patch) | |
tree | b76db3dc8173189591d65cc9a1a4e181331ca8f8 /plugins/Dbx_sqlite/src/dbsettings.cpp | |
parent | 6ef65121fed3c38c467238a08bf96bf98a23d7d8 (diff) |
SRMM: better support for group chats in database
Diffstat (limited to 'plugins/Dbx_sqlite/src/dbsettings.cpp')
-rw-r--r-- | plugins/Dbx_sqlite/src/dbsettings.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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);
}
}
|