Use keyword as index name

This commit is contained in:
arne 2025-11-18 22:14:08 +01:00
commit 9505023718

View file

@ -353,7 +353,7 @@
refresh-id (js/Date.now)] refresh-id (js/Date.now)]
(swap! state update-in [:section/posts :loading] conj refresh-id) (swap! state update-in [:section/posts :loading] conj refresh-id)
(-> (js/Promise.all #js [(db/count! ::db/posts) (-> (js/Promise.all #js [(db/count! ::db/posts)
(-> (db/open-cursor! ::db/posts "created_at" db/all "prev") (-> (db/open-cursor! ::db/posts ::db/post-created-at db/all "prev")
(db/transduce-cursor xform))]) (db/transduce-cursor xform))])
(.then (fn [[total displayed-posts]] (.then (fn [[total displayed-posts]]
(swap! state update :section/posts #(-> (assoc % :total total) (swap! state update :section/posts #(-> (assoc % :total total)
@ -451,7 +451,7 @@
(db/create-object-store! db ::db/posts {:keyPath "id"})) (db/create-object-store! db ::db/posts {:keyPath "id"}))
2 (fn migration-0002 [_ txn] 2 (fn migration-0002 [_ txn]
(-> (db/open-store txn ::db/posts "readwrite") (-> (db/open-store txn ::db/posts "readwrite")
(db/create-index! "created_at" "created_at" {:unique false})))}) (db/create-index! ::db/post-created-at "created_at" {:unique false})))})
;; go go go ;; go go go