From cadbd3395747dceed7c7a4fdb7967d5a007f3bbf Mon Sep 17 00:00:00 2001 From: Richard van der Hoff Date: Wed, 29 Oct 2025 15:33:48 +0000 Subject: [PATCH] sqlite: add room_id index on direct_withheld_info table --- .../crypto_store/012_withheld_code_by_room.sql | 2 ++ crates/matrix-sdk-sqlite/src/crypto_store.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 crates/matrix-sdk-sqlite/migrations/crypto_store/012_withheld_code_by_room.sql diff --git a/crates/matrix-sdk-sqlite/migrations/crypto_store/012_withheld_code_by_room.sql b/crates/matrix-sdk-sqlite/migrations/crypto_store/012_withheld_code_by_room.sql new file mode 100644 index 000000000..0d5948c27 --- /dev/null +++ b/crates/matrix-sdk-sqlite/migrations/crypto_store/012_withheld_code_by_room.sql @@ -0,0 +1,2 @@ +CREATE INDEX "direct_withheld_info_room_id_idx" + ON "direct_withheld_info" ("room_id"); diff --git a/crates/matrix-sdk-sqlite/src/crypto_store.rs b/crates/matrix-sdk-sqlite/src/crypto_store.rs index c0588f7de..9e05e7aed 100644 --- a/crates/matrix-sdk-sqlite/src/crypto_store.rs +++ b/crates/matrix-sdk-sqlite/src/crypto_store.rs @@ -291,6 +291,16 @@ async fn run_migrations(conn: &SqliteAsyncConn, version: u8) -> Result<()> { .await?; } + if version < 12 { + conn.with_transaction(|txn| { + txn.execute_batch(include_str!( + "../migrations/crypto_store/012_withheld_code_by_room.sql" + ))?; + txn.set_db_version(12) + }) + .await?; + } + Ok(()) }