mirror of
https://github.com/logseq/logseq.git
synced 2026-05-28 06:34:34 +00:00
fix: all blocks in sqlite should have UUID
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
(:require [frontend.db.utils :as db-utils]
|
||||
[frontend.db :as db]
|
||||
[datascript.core :as d]
|
||||
[frontend.util :as util]))
|
||||
[frontend.util :as util]
|
||||
[frontend.state :as state]))
|
||||
|
||||
;; shortcut for query a block with string ref
|
||||
(defn qb
|
||||
@@ -45,3 +46,10 @@
|
||||
(vector? x)
|
||||
(= :block/uuid (first x))
|
||||
(nil? (second x)))))))
|
||||
|
||||
(defn get-all-blocks
|
||||
[]
|
||||
(when-let [db (db/get-db)]
|
||||
(->> (d/datoms db :avet :block/uuid)
|
||||
(map :e)
|
||||
db/pull-many)))
|
||||
|
||||
@@ -155,10 +155,7 @@
|
||||
(assoc b :page_uuid page-uuid)
|
||||
b)))
|
||||
(map (fn [b]
|
||||
(let [uuid (or (:block/uuid b)
|
||||
(:db/ident b)
|
||||
(:file/path b)
|
||||
(random-uuid))]
|
||||
(let [uuid (or (:block/uuid b) (random-uuid))]
|
||||
(assoc b :block/uuid uuid)))))]
|
||||
(p/let [ipc-result (ipc/ipc :db-transact-data repo
|
||||
(pr-str
|
||||
|
||||
Reference in New Issue
Block a user