Skip to content

Commit 115b83b

Browse files
committed
Indexdb migration
1 parent d751a16 commit 115b83b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

crates/matrix-sdk-indexeddb/src/crypto_store.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl IndexeddbCryptoStore {
146146
let name = format!("{prefix:0}::matrix-sdk-crypto");
147147

148148
// Open my_db v1
149-
let mut db_req: OpenDbRequest = IdbDatabase::open_f64(&name, 1.1)?;
149+
let mut db_req: OpenDbRequest = IdbDatabase::open_f64(&name, 2.0)?;
150150
db_req.set_on_upgrade_needed(Some(|evt: &IdbVersionChangeEvent| -> Result<(), JsValue> {
151151
let old_version = evt.old_version();
152152

@@ -169,8 +169,6 @@ impl IndexeddbCryptoStore {
169169
db.create_object_store(KEYS::SECRET_REQUESTS_BY_INFO)?;
170170

171171
db.create_object_store(KEYS::BACKUP_KEYS)?;
172-
173-
db.create_object_store(KEYS::ROOM_SETTINGS)?;
174172
} else if old_version < 1.1 {
175173
// We changed how we store inbound group sessions, the key used to
176174
// be a trippled of `(room_id, sender_key, session_id)` now it's a
@@ -184,6 +182,11 @@ impl IndexeddbCryptoStore {
184182
db.create_object_store(KEYS::INBOUND_GROUP_SESSIONS)?;
185183
}
186184

185+
if old_version < 2.0 {
186+
let db = evt.db();
187+
db.create_object_store(KEYS::ROOM_SETTINGS)?;
188+
}
189+
187190
Ok(())
188191
}));
189192

0 commit comments

Comments
 (0)