add :logseq.kv/local-graph-uuid

This commit is contained in:
Tienson Qin
2026-01-01 14:11:39 +08:00
parent 3078f2a900
commit b55550ed3e
6 changed files with 24 additions and 18 deletions

View File

@@ -587,12 +587,14 @@
(def kv sqlite-util/kv)
;; TODO: why not generate a UUID for all local graphs?
;; And prefer this local graph UUID when picking an ID for new rtc graph?
(defn get-graph-rtc-uuid
[db]
(when db (get-key-value db :logseq.kv/graph-uuid)))
(defn get-graph-local-uuid
[db]
(when db (get-key-value db :logseq.kv/local-graph-uuid)))
(defn get-graph-schema-version
[db]
(when db (get-key-value db :logseq.kv/schema-version)))

View File

@@ -10,6 +10,9 @@
:logseq.kv/graph-uuid {:doc "Store graph-uuid if it's a rtc enabled graph"
:rtc {:rtc/ignore-entity-when-init-upload true
:rtc/ignore-entity-when-init-download true}}
:logseq.kv/local-graph-uuid {:doc "Store graph-uuid if it's a local graph"
:rtc {:rtc/ignore-entity-when-init-upload true
:rtc/ignore-entity-when-init-download true}}
:logseq.kv/import-type {:doc "If graph is imported, identifies how a graph is imported including which UI or CLI import process. CLI scripts can set this to a custom value.
UI values include :file-graph and :sqlite-db and CLI values start with :cli e.g. :cli/default."}
:logseq.kv/imported-at {:doc "Time if graph is imported"}

View File

@@ -237,7 +237,8 @@
graph-git-sha
(conj (sqlite-util/kv :logseq.kv/graph-git-sha graph-git-sha))
true
(conj (sqlite-util/kv :logseq.kv/graph-uuid (common-uuid/gen-uuid))))
(conj (sqlite-util/kv :logseq.kv/local-graph-uuid
(uuid (str "loc" (subs (str (common-uuid/gen-uuid)) 3))))))
initial-files (build-initial-files config-content)
{properties-tx :tx :keys [properties]} (build-initial-properties)
db-ident->properties (zipmap (map :db/ident properties) properties)