Page MenuHomePhabricator

D11577.diff
No OneTemporary

D11577.diff

diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
--- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
+++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp
@@ -595,6 +595,30 @@
return create_table(db, query, "aux_users");
}
+bool add_version_column_to_olm_persist_sessions_table(sqlite3 *db) {
+ char *error;
+ sqlite3_exec(
+ db,
+ "ALTER TABLE olm_persist_sessions "
+ " RENAME COLUMN `target_user_id` TO `target_device_id`; "
+ "ALTER TABLE olm_persist_sessions "
+ " ADD COLUMN version INTEGER NOT NULL DEFAULT 1;",
+ nullptr,
+ nullptr,
+ &error);
+
+ if (!error) {
+ return true;
+ }
+
+ std::ostringstream stringStream;
+ stringStream << "Error updating olm_persist_sessions table: " << error;
+ Logger::log(stringStream.str());
+
+ sqlite3_free(error);
+ return false;
+}
+
bool create_schema(sqlite3 *db) {
char *error;
sqlite3_exec(
@@ -621,8 +645,9 @@
");"
"CREATE TABLE IF NOT EXISTS olm_persist_sessions ("
- " target_user_id TEXT UNIQUE PRIMARY KEY NOT NULL,"
- " session_data TEXT NOT NULL"
+ " target_device_id TEXT UNIQUE PRIMARY KEY NOT NULL,"
+ " session_data TEXT NOT NULL,"
+ " version INTEGER NOT NULL DEFAULT 1"
");"
"CREATE TABLE IF NOT EXISTS media ("
@@ -968,7 +993,8 @@
{38, {[](sqlite3 *) { return true; }, false}},
{39, {create_synced_metadata_table, true}},
{40, {create_keyservers_synced, true}},
- {41, {create_aux_user_table, true}}}};
+ {41, {create_aux_user_table, true}},
+ {42, {add_version_column_to_olm_persist_sessions_table, true}}}};
enum class MigrationResult { SUCCESS, FAILURE, NOT_APPLIED };
diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 1:02 AM (21 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2595321
Default Alt Text
D11577.diff (2 KB)

Event Timeline