diff --git a/src/computersandblues/lodestone/app.cljs b/src/computersandblues/lodestone/app.cljs index bd5e7c0..0919ea2 100644 --- a/src/computersandblues/lodestone/app.cljs +++ b/src/computersandblues/lodestone/app.cljs @@ -633,7 +633,7 @@ (def data-migrations {4 (fn =0004-convert-internal-ids [db] - (let [cursor (db/open-cursor db ::db/posts ::db/post-internal-id ::db/all) + (let [cursor (db/open-cursor db ::db/posts ::db/all {:index ::db/post-internal-id}) result (db/transduce-cursor (filter (comp string? (j/get :internal_id))) cursor)] (.then result (fn [rows] diff --git a/src/computersandblues/lodestone/database.cljs b/src/computersandblues/lodestone/database.cljs index 9c57f7a..e8b2072 100644 --- a/src/computersandblues/lodestone/database.cljs +++ b/src/computersandblues/lodestone/database.cljs @@ -14,7 +14,7 @@ (doto request (.addEventListener "success" (fn [ev] - (let [db (.-result request)] + (let [db (-> ev .-target .-result)] ; see https://javascript.info/indexeddb#parallel-update-problem (.addEventListener db "versionchange" (fn [] @@ -130,7 +130,7 @@ key-range (if (= key-range ::all) (js/IDBKeyRange.lowerBound js/Number.NEGATIVE_INFINITY) key-range) - direction ({:asc "next" :desc "prev"} direction direction)] + direction ({:asc "next" :desc "prev"} direction "next")] (if index (.openCursor (.index store (str index)) key-range direction) (.openCursor store key-range direction)))))