Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3356700
D11168.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D11168.diff
View Options
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
@@ -512,6 +512,24 @@
return create_table(db, query, "communities");
}
+bool create_messages_to_device_table(sqlite3 *db) {
+ std::string query =
+ "CREATE TABLE IF NOT EXISTS messages_to_device ("
+ " message_id TEXT NOT NULL,"
+ " device_id TEXT NOT NULL,"
+ " user_id TEXT NOT NULL,"
+ " timestamp BIGINT NOT NULL,"
+ " plaintext TEXT NOT NULL,"
+ " ciphertext TEXT NOT NULL,"
+ " PRIMARY KEY (message_id, device_id)"
+ ");"
+
+ "CREATE INDEX IF NOT EXISTS messages_to_device_idx_id_timestamp"
+ " ON messages_to_device (device_id, timestamp);";
+
+ return create_table(db, query, "messages_to_device");
+}
+
bool create_schema(sqlite3 *db) {
char *error;
sqlite3_exec(
@@ -605,11 +623,25 @@
" community_info TEXT NOT NULL"
");"
+ "CREATE TABLE IF NOT EXISTS messages_to_device ("
+ " message_id TEXT NOT NULL,"
+ " device_id TEXT NOT NULL,"
+ " user_id TEXT NOT NULL,"
+ " timestamp BIGINT NOT NULL,"
+ " plaintext TEXT NOT NULL,"
+ " ciphertext TEXT NOT NULL,"
+ " PRIMARY KEY (message_id, device_id)"
+ ");"
+
"CREATE INDEX IF NOT EXISTS media_idx_container"
" ON media (container);"
"CREATE INDEX IF NOT EXISTS messages_idx_thread_time"
- " ON messages (thread, time);",
+ " ON messages (thread, time);"
+
+ "CREATE INDEX IF NOT EXISTS messages_to_device_idx_id_timestamp"
+ " ON messages_to_device (device_id, timestamp);",
+
nullptr,
nullptr,
&error);
@@ -845,7 +877,8 @@
{32, {create_users_table, true}},
{33, {create_keyservers_table, true}},
{34, {enable_rollback_journal_mode, false}},
- {35, {create_communities_table, true}}}};
+ {35, {create_communities_table, true}},
+ {36, {create_messages_to_device_table, true}}}};
enum class MigrationResult { SUCCESS, FAILURE, NOT_APPLIED };
@@ -1796,7 +1829,8 @@
std::string removeDeviceSpecificDataSQL =
"DELETE FROM olm_persist_account;"
"DELETE FROM olm_persist_sessions;"
- "DELETE FROM metadata;";
+ "DELETE FROM metadata;"
+ "DELETE FROM messages_to_device;";
executeQuery(backupDB, removeDeviceSpecificDataSQL);
executeQuery(backupDB, "VACUUM;");
sqlite3_close(backupDB);
diff --git a/web/database/_generated/comm_query_executor.wasm b/web/database/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 8:05 PM (19 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569698
Default Alt Text
D11168.diff (2 KB)
Attached To
Mode
D11168: [SQLite] add table for messages to device
Attached
Detach File
Event Timeline
Log In to Comment