Skip to content

Commit

Permalink
fix: new and imported graphs invalid b/c of user migration
Browse files Browse the repository at this point in the history
Follow up to f5f8571
  • Loading branch information
logseq-cldwalker committed Dec 20, 2024
1 parent bdadbeb commit 513f52c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
17 changes: 1 addition & 16 deletions deps/db/src/logseq/db/frontend/property.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -422,21 +422,6 @@
{:type :map
:hide? false ; TODO: show for debug now, hide it later
:public? false}}
:logseq.user/name {:title "User Name"
:schema
{:type :string
:hide? false
:public? true}}
:logseq.user/email {:title "User Email"
:schema
{:type :string
:hide? false
:public? true}}
:logseq.user/avatar {:title "User Avatar"
:schema
{:type :string
:hide? false
:public? true}}
:logseq.property.user/name {:title "User Name"
:schema
{:type :string
Expand Down Expand Up @@ -499,7 +484,7 @@
;; attribute ns is for db attributes that don't start with :block
"logseq.property.attribute"
"logseq.property.journal" "logseq.property.class" "logseq.property.view"
"logseq.user"})
"logseq.property.user"})

(defn logseq-property?
"Determines if keyword is a logseq property"
Expand Down
14 changes: 9 additions & 5 deletions src/main/frontend/worker/db/migrate.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,14 @@
[?b :logseq.user/email]
[?b :logseq.user/avatar])]
db)]
(mapcat (fn [e] [[:db/retract e :logseq.user/name]
[:db/retract e :logseq.user/email]
[:db/retract e :logseq.user/avatar]])
db-ids)))))
(into
[[:db/retractEntity :logseq.user/name]
[:db/retractEntity :logseq.user/email]
[:db/retractEntity :logseq.user/avatar]]
(mapcat (fn [e] [[:db/retract e :logseq.user/name]
[:db/retract e :logseq.user/email]
[:db/retract e :logseq.user/avatar]])
db-ids))))))

(def schema-version->updates
"A vec of tuples defining datascript migrations. Each tuple consists of the
Expand Down Expand Up @@ -510,7 +514,7 @@
[47 {:fix replace-hidden-type-with-schema}]
[48 {:properties [:logseq.property/default-value :logseq.property/scalar-default-value]}]
[49 {:fix replace-special-id-ref-with-id-ref}]
[50 {:properties [:logseq.user/name :logseq.user/email :logseq.user/avatar]}]
[50 {:properties [:logseq.property.user/name :logseq.property.user/email :logseq.property.user/avatar]}]
[51 {:properties [:logseq.property.user/name :logseq.property.user/email :logseq.property.user/avatar]
:fix deprecate-logseq-user-ns}]])

Expand Down

0 comments on commit 513f52c

Please sign in to comment.