From 06d2d2e198275750dce8c04ec11c63c1b1650014 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Thu, 18 Apr 2019 20:19:43 +0200 Subject: [PATCH] draft of idb store for fragments --- src/matrix/storage/idb/create.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/matrix/storage/idb/create.js b/src/matrix/storage/idb/create.js index 42f66e04..185f4992 100644 --- a/src/matrix/storage/idb/create.js +++ b/src/matrix/storage/idb/create.js @@ -10,10 +10,12 @@ function createStores(db) { db.createObjectStore("session", {keyPath: "key"}); // any way to make keys unique here? (just use put?) db.createObjectStore("roomSummary", {keyPath: "roomId"}); + + db.createObjectStore("timelineFragments", {keyPath: ["roomId", "id"]}); // needs roomId separate because it might hold a gap and no event - const timeline = db.createObjectStore("roomTimeline", {keyPath: ["roomId", "sortKey"]}); - timeline.createIndex("byEventId", [ - "roomId", + const timelineEvents = db.createObjectStore("timelineEvents", {keyPath: ["event.room_id", "fragmentId", "sortKey"]}); + timelineEvents.createIndex("byEventId", [ + "event.room_id", "event.event_id" ], {unique: true}); @@ -29,4 +31,4 @@ function createStores(db) { // "event.state_key" // ]}); // roomMembers.createIndex("byName", ["room_id", "content.name"]); -} \ No newline at end of file +}