mirror of
https://github.com/logseq/logseq.git
synced 2026-05-05 19:36:35 +00:00
chore: mv table property idents to their own ns
table feature will grow with time and could benefit from its own ns
This commit is contained in:
@@ -43,6 +43,26 @@
|
||||
[{:db/id (:db/id (d/entity @conn :logseq.class/task))
|
||||
:db/ident :logseq.class/Task}])
|
||||
|
||||
(defn- update-table-properties
|
||||
[conn _search-db]
|
||||
(let [old-new-props {:logseq.property/table-sorting :logseq.property.table/sorting
|
||||
:logseq.property/table-filters :logseq.property.table/filters
|
||||
:logseq.property/table-ordered-columns :logseq.property.table/ordered-columns
|
||||
:logseq.property/table-hidden-columns :logseq.property.table/hidden-columns}
|
||||
props-tx (mapv (fn [[old new]]
|
||||
{:db/id (:db/id (d/entity @conn old))
|
||||
:db/ident new})
|
||||
old-new-props)]
|
||||
;; Property changes need to be in their own tx for subsequent uses of properties to take effect
|
||||
(ldb/transact! conn props-tx {:db-migrate? true})
|
||||
|
||||
(mapcat (fn [[old new]]
|
||||
(->> (d/q '[:find ?b ?prop-v :in $ ?prop :where [?b ?prop ?prop-v]] @conn old)
|
||||
(mapcat (fn [[id prop-value]]
|
||||
[[:db/retract id old]
|
||||
[:db/add id new prop-value]]))))
|
||||
old-new-props)))
|
||||
|
||||
(def schema-version->updates
|
||||
[[3 {:properties [:logseq.property/table-sorting :logseq.property/table-filters
|
||||
:logseq.property/table-hidden-columns :logseq.property/table-ordered-columns]
|
||||
@@ -58,7 +78,8 @@
|
||||
[6 {:properties [:logseq.property.asset/remote-metadata]}]
|
||||
[7 {:fix replace-original-name-content-with-title}]
|
||||
[8 {:fix replace-object-and-page-type-with-node}]
|
||||
[9 {:fix update-task-ident}]])
|
||||
[9 {:fix update-task-ident}]
|
||||
[10 {:fix update-table-properties}]])
|
||||
|
||||
(let [max-schema-version (apply max (map first schema-version->updates))]
|
||||
(assert (<= db-schema/version max-schema-version))
|
||||
|
||||
Reference in New Issue
Block a user