From 8018753332429f37722fcbbf2a5efd58e055bb39 Mon Sep 17 00:00:00 2001 From: Michael Goldenberg Date: Mon, 25 Aug 2025 17:40:57 -0400 Subject: [PATCH] refactor(indexeddb): add primary key to core object store in event cache database Signed-off-by: Michael Goldenberg --- .../src/event_cache_store/migrations.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/matrix-sdk-indexeddb/src/event_cache_store/migrations.rs b/crates/matrix-sdk-indexeddb/src/event_cache_store/migrations.rs index ef5db3eb5..9978ea906 100644 --- a/crates/matrix-sdk-indexeddb/src/event_cache_store/migrations.rs +++ b/crates/matrix-sdk-indexeddb/src/event_cache_store/migrations.rs @@ -109,6 +109,7 @@ pub mod v1 { pub mod keys { pub const CORE: &str = "core"; + pub const CORE_KEY_PATH: &str = "id"; pub const LEASES: &str = "leases"; pub const LEASES_KEY_PATH: &str = "id"; pub const ROOMS: &str = "rooms"; @@ -142,8 +143,12 @@ pub mod v1 { } /// Create an object store for tracking miscellaneous information + /// + /// * Primary Key - `id` fn create_core_object_store(db: &IdbDatabase) -> Result<(), DomException> { - let _ = db.create_object_store(keys::CORE)?; + let mut object_store_params = IdbObjectStoreParameters::new(); + object_store_params.key_path(Some(&keys::CORE_KEY_PATH.into())); + let _ = db.create_object_store_with_params(keys::CORE, &object_store_params)?; Ok(()) }