diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchema.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchema.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchema.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchema.cpp @@ -241,6 +241,14 @@ " status TEXT NOT NULL" ");" + "CREATE TABLE IF NOT EXISTS queued_dm_operations (" + " id INTEGER PRIMARY KEY AUTOINCREMENT," + " queue_type TEXT NOT NULL," + " queue_key TEXT NOT NULL," + " operation_data TEXT NOT NULL," + " timestamp INTEGER NOT NULL" + ");" + "CREATE INDEX IF NOT EXISTS media_idx_container" " ON media (container);" @@ -263,7 +271,12 @@ " ON outbound_p2p_messages (device_id, timestamp);" "CREATE INDEX IF NOT EXISTS dm_operations_idx_type" - " ON dm_operations (type);"; + " ON dm_operations (type);" + + "CREATE INDEX IF NOT EXISTS queued_dm_operations_idx_timestamp" + " ON queued_dm_operations (timestamp);" + "CREATE INDEX IF NOT EXISTS queued_dm_operations_idx_queue" + " ON queued_dm_operations (queue_type, queue_key);"; char *error; sqlite3_exec(db, query.c_str(), nullptr, nullptr, &error); diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchemaMigrations.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchemaMigrations.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchemaMigrations.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteSchemaMigrations.cpp @@ -917,6 +917,24 @@ return SQLiteSchema::createTable(db, query, "holders"); } +bool create_queued_dm_operations_table(sqlite3 *db) { + std::string query = + "CREATE TABLE IF NOT EXISTS queued_dm_operations (" + " id INTEGER PRIMARY KEY AUTOINCREMENT," + " queue_type TEXT NOT NULL," + " queue_key TEXT NOT NULL," + " operation_data TEXT NOT NULL," + " timestamp INTEGER NOT NULL" + ");" + + "CREATE INDEX IF NOT EXISTS queued_dm_operations_idx_timestamp" + " ON queued_dm_operations (timestamp);" + "CREATE INDEX IF NOT EXISTS queued_dm_operations_idx_queue" + " ON queued_dm_operations (queue_type, queue_key);"; + + return SQLiteSchema::createTable(db, query, "queued_dm_operations"); +} + SQLiteMigrations SQLiteSchema::migrations{ {{1, {create_drafts_table, true}}, {2, {rename_threadID_to_key, true}}, @@ -964,6 +982,7 @@ {54, {create_dm_operations_table, true}}, {55, {convert_target_message_to_standard_column, true}}, {56, {create_backup_tables, true}}, - {57, {create_holders_table, true}}}}; + {57, {create_holders_table, true}}, + {58, {create_queued_dm_operations_table, true}}}}; } // namespace comm 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$@