Explorar el Código

Remove more cases of :block/schema

Tienson Qin hace 9 meses
padre
commit
93a7034249

+ 4 - 2
deps/db/script/create_graph/inferred.edn

@@ -10,9 +10,11 @@
  :classes {:Movie {:build/schema-properties [:actor :comment]}
            :Meeting {:build/schema-properties [:attendee :duration]}}
  :properties
- {:actor {:block/schema {:type :node :cardinality :many}
+ {:actor {:property/type :node
+          :db/cardinality :many
           :build/schema-classes [:Person]}
-  :attendee {:block/schema {:type :node :cardinality :many}
+  :attendee {:property/type :node
+             :db/cardinality :many
              :build/schema-classes [:Person]}}
  :pages-and-blocks
  [{:page {:block/title "Matt-Damon" :build/tags [:Person]}}

+ 5 - 0
deps/db/src/logseq/db/frontend/property.cljs

@@ -777,3 +777,8 @@
   [entity]
   ;; No need to do :built-in? check yet since user properties can't set this
   (:property/public? entity))
+
+(defn get-property-schema
+  [property-m]
+  (select-keys property-m [:db/cardinality :property/type :property/hide?
+                           :property/public? :property/view-context :property/ui-position]))

+ 1 - 1
deps/db/src/logseq/db/frontend/property/build.cljs

@@ -54,7 +54,7 @@
   "Builds all the tx needed for property with closed values including
    the hidden page and closed value blocks as needed"
   [db-ident prop-name property {:keys [property-attributes properties]}]
-  (let [property-schema (:block/schema property)
+  (let [property-schema (:schema property)
         property-tx (merge (sqlite-util/build-new-property db-ident property-schema {:title prop-name
                                                                                      :ref-type? true
                                                                                      :properties properties})

+ 6 - 8
deps/db/src/logseq/db/sqlite/build.cljs

@@ -93,10 +93,10 @@
                      (let [property-map {:db/ident k
                                          :property/type built-in-type'}]
                        [property-map v])))
-                 (when (and (db-property-type/value-ref-property-types (get-in properties-config [k :block/schema :type]))
+                 (when (and (db-property-type/value-ref-property-types (get-in properties-config [k :property/type]))
                             ;; TODO: Support translate-property-value without this hack
                             (not (vector? v)))
-                   (let [prop-type (get-in properties-config [k :block/schema :type])
+                   (let [prop-type (get-in properties-config [k :property/type])
                          property-map {:db/ident (get-ident all-idents k)
                                        :original-property-id k
                                        :property/type prop-type}]
@@ -156,7 +156,7 @@
                                  (throw (ex-info "No :db/id for property" {:property prop-name})))}
                      (select-keys prop-m [:build/properties-ref-types]))}))
           [(merge (sqlite-util/build-new-property (get-ident all-idents prop-name)
-                                                  (:block/schema prop-m)
+                                                  (db-property/get-property-schema prop-m)
                                                   {:block-uuid (:block/uuid prop-m)
                                                    :title (:block/title prop-m)})
                   {:db/id (or (property-db-ids prop-name)
@@ -257,8 +257,6 @@
   [:map-of
    Property
    [:map
-    [:block/schema [:map
-                    [:type :keyword]]]
     [:build/properties {:optional true} User-properties]
     [:build/properties-ref-types {:optional true}
      [:map-of :keyword :keyword]]
@@ -502,9 +500,9 @@
                       :node
                       (db-property-type/infer-property-type-from-value prop-value'))
                     :default)]
-    (cond-> {:block/schema {:type prop-type}}
+    (cond-> {:property/type prop-type}
       (coll? prop-value)
-      (assoc-in [:block/schema :cardinality] :many))))
+      (assoc :db/cardinality :many))))
 
 (defn- auto-create-ontology
   "Auto creates properties and classes from uses of options.  Creates properties
@@ -580,7 +578,7 @@
           Allows for outlines to be expressed to whatever depth
        * :build/properties - Defines properties on a block
    * :properties - This is a map to configure properties where the keys are property name keywords
-     and the values are maps of datascript attributes e.g. `{:block/schema {:type :checkbox}}`.
+     and the values are maps of datascript attributes e.g. `{:property/type :checkbox}`.
      Additional keys available:
      * :build/properties - Define properties on a property page.
      * :build/closed-values - Define closed values with a vec of maps. A map contains keys :uuid, :value and :icon.

+ 1 - 1
deps/db/src/logseq/db/sqlite/create_graph.cljs

@@ -25,7 +25,7 @@
                                  (db-property-build/build-closed-values
                                   db-ident
                                   prop-name
-                                  {:db/ident db-ident :block/schema schema :closed-values closed-values}
+                                  {:db/ident db-ident :schema schema :closed-values closed-values}
                                   {:properties properties})
                                  [(sqlite-util/build-new-property
                                    db-ident

+ 8 - 6
deps/db/test/logseq/db/frontend/rules_test.cljs

@@ -28,8 +28,8 @@
 
 (deftest has-property-rule
   (let [conn (db-test/create-conn-with-blocks
-              {:properties {:foo {:block/schema {:type :default}}
-                            :foo2 {:block/schema {:type :default}}}
+              {:properties {:foo {:property/type :default}
+                            :foo2 {:property/type :default}}
                :pages-and-blocks
                [{:page {:block/title "Page1"
                         :build/properties {:foo "bar"}}}]})]
@@ -52,10 +52,12 @@
 
 (deftest property-rule
   (let [conn (db-test/create-conn-with-blocks
-              {:properties {:foo {:block/schema {:type :default}}
-                            :foo2 {:block/schema {:type :default}}
-                            :number-many {:block/schema {:type :number :cardinality :many}}
-                            :page-many {:block/schema {:type :node :cardinality :many}}}
+              {:properties {:foo {:property/type :default}
+                            :foo2 {:property/type :default}
+                            :number-many {:property/type :number
+                                          :db/cardinality :many}
+                            :page-many {:property/type :node
+                                        :db/cardinality :many}}
                :pages-and-blocks
                [{:page {:block/title "Page1"
                         :build/properties {:foo "bar" :number-many #{5 10} :page-many #{[:page "Page A"]}}}}

+ 1 - 1
deps/db/test/logseq/db/sqlite/create_graph_test.cljs

@@ -102,7 +102,7 @@
     (testing ":url property"
       (sqlite-build/create-blocks
        conn
-       {:properties {:url {:block/schema {:type :url}}}
+       {:properties {:url {:property/type :url}}
         :pages-and-blocks
         [{:page {:block/title "page1"}
           :blocks [{:block/title "b1" :build/properties {:url "https://logseq.com"}}

+ 5 - 5
deps/db/test/logseq/db_test.cljs

@@ -1,8 +1,8 @@
 (ns logseq.db-test
   (:require [cljs.test :refer [deftest is]]
-            [logseq.db.frontend.schema :as db-schema]
             [datascript.core :as d]
             [logseq.db :as ldb]
+            [logseq.db.frontend.schema :as db-schema]
             [logseq.db.test.helper :as db-test]))
 
 ;;; datoms
@@ -55,8 +55,8 @@
 (deftest get-case-page
   (let [conn (db-test/create-conn-with-blocks
               {:properties
-               {:foo {:block/schema {:type :default}}
-                :Foo {:block/schema {:type :default}}}
+               {:foo {:property/type :default}
+                :Foo {:property/type :default}}
                :classes {:movie {} :Movie {}}})]
     ;; Case sensitive properties
     (is (= "foo" (:block/title (ldb/get-case-page @conn "foo"))))
@@ -68,8 +68,8 @@
 (deftest page-exists
   (let [conn (db-test/create-conn-with-blocks
               {:properties
-               {:foo {:block/schema {:type :default}}
-                :Foo {:block/schema {:type :default}}}
+               {:foo {:property/type :default}
+                :Foo {:property/type :default}}
                :classes {:movie {} :Movie {}}})]
     (is (= ["foo"]
            (map #(:block/title (d/entity @conn %)) (ldb/page-exists? @conn "foo" #{:logseq.class/Property})))

+ 12 - 7
deps/graph-parser/src/logseq/graph_parser/exporter.cljs

@@ -604,12 +604,14 @@
                             ;; closed values are referenced by their :db/ident so no need to create values
                             (not (get-in db-property/built-in-properties [k :closed-values])))
                    (let [property-map {:db/ident k
-                                       :block/schema {:type built-in-type}}]
+                                       :property/type built-in-type}]
                      [property-map v]))
                  (when (db-property-type/value-ref-property-types (:type (get-schema-fn k)))
-                   (let [property-map {:db/ident (get-ident all-idents k)
-                                       :original-property-id k
-                                       :block/schema (get-schema-fn k)}]
+                   (let [schema (get-schema-fn k)
+                         property-map (merge
+                                       {:db/ident (get-ident all-idents k)
+                                        :original-property-id k}
+                                       (sqlite-util/schema->qualified-property-keyword schema))]
                      [property-map v])))))
        (db-property-build/build-property-values-tx-m new-block)))
 
@@ -1092,7 +1094,9 @@
                    upstream-tx
                    (when (= :default (:type schema))
                      (build-upstream-properties-tx-for-default db prop prop-ident from-type block-properties-text-values))
-                   property-pages-tx [{:db/ident prop-ident :block/schema schema}]]
+                   property-pages-tx [(merge
+                                       {:db/ident prop-ident}
+                                       (sqlite-util/schema->qualified-property-keyword schema))]]
                ;; If we handle cardinality changes we would need to return these separately
                ;; as property-pages would need to be transacted separately
                (concat property-pages-tx upstream-tx)))
@@ -1160,9 +1164,10 @@
                      db-ident (get-ident @(:all-idents import-state) kw-name)
                      new-prop (sqlite-util/build-new-property db-ident
                                                               (get-property-schema @(:property-schemas import-state) kw-name)
-                                                              {:title (name kw-name)})]
+                                                              {:title (name kw-name)})
+                     property-keys (filter (fn [k] (= "property" (namespace k))) (keys new-prop))]
                  (assert existing-page-uuid)
-                 (merge (select-keys new-prop [:block/tags :block/schema :db/ident :db/index :db/cardinality :db/valueType])
+                 (merge (select-keys new-prop (into [:block/tags :db/ident :property/type :db/index :db/cardinality :db/valueType] property-keys))
                         {:block/uuid existing-page-uuid})))
              (set/intersection new-properties (set (map keyword (keys existing-pages)))))
         ;; Could do this only for existing pages but the added complexity isn't worth reducing the tx noise

+ 15 - 15
deps/graph-parser/test/logseq/graph_parser/exporter_test.cljs

@@ -227,24 +227,24 @@
                   (remove #(db-malli-schema/internal-ident? (:db/ident %)))
                   count))
           "Correct number of user properties")
-      (is (= #{{:db/ident :user.property/prop-bool :block/schema {:type :checkbox}}
-               {:db/ident :user.property/prop-string :block/schema {:type :default}}
-               {:db/ident :user.property/prop-num :block/schema {:type :number}}
-               {:db/ident :user.property/sameas :block/schema {:type :url}}
-               {:db/ident :user.property/rangeincludes :block/schema {:type :node}}
-               {:db/ident :user.property/startedat :block/schema {:type :date}}}
+      (is (= #{{:db/ident :user.property/prop-bool :property/type :checkbox}
+               {:db/ident :user.property/prop-string :property/type :default}
+               {:db/ident :user.property/prop-num :property/type :number}
+               {:db/ident :user.property/sameas :property/type :url}
+               {:db/ident :user.property/rangeincludes :property/type :node}
+               {:db/ident :user.property/startedat :property/type :date}}
              (->> @conn
-                  (d/q '[:find [(pull ?b [:db/ident :block/schema]) ...]
+                  (d/q '[:find [(pull ?b [:db/ident :property/type]) ...]
                          :where [?b :block/tags :logseq.class/Property]])
                   (filter #(contains? #{:prop-bool :prop-string :prop-num :rangeincludes :sameas :startedat}
                                       (keyword (name (:db/ident %)))))
                   set))
           "Main property types have correct inferred :type")
       (is (= :default
-             (get-in (d/entity @conn :user.property/description) [:block/schema :type]))
+             (:property/type (d/entity @conn :user.property/description)))
           "Property value consisting of text and refs is inferred as :default")
       (is (= :url
-             (get-in (d/entity @conn :user.property/url) [:block/schema :type]))
+             (:property/type (d/entity @conn :user.property/url)))
           "Property value with a macro correctly inferred as :url")
 
       (is (= {:user.property/prop-bool true
@@ -426,14 +426,14 @@
 
     (testing "property :type changes"
       (is (= :node
-             (get-in (d/entity @conn :user.property/finishedat) [:block/schema :type]))
+             (:property/type (d/entity @conn :user.property/finishedat)))
           ":date property to :node value changes to :node")
       (is (= :node
-             (get-in (d/entity @conn :user.property/participants) [:block/schema :type]))
+             (:property/type (d/entity @conn :user.property/participants)))
           ":node property to :date value remains :node")
 
       (is (= :default
-             (get-in (d/entity @conn :user.property/description) [:block/schema :type]))
+             (:property/type (d/entity @conn :user.property/description)))
           ":default property to :node (or any non :default value) remains :default")
       (is (= "[[Jakob]]"
              (:user.property/description (readable-properties @conn (db-test/find-block-by-content @conn #":default to :node"))))
@@ -441,14 +441,14 @@
 
       (testing "with changes to upstream/existing property value"
         (is (= :default
-               (get-in (d/entity @conn :user.property/duration) [:block/schema :type]))
+               (:property/type (d/entity @conn :user.property/duration)))
             ":number property to :default value changes to :default")
         (is (= "20"
                (:user.property/duration (readable-properties @conn (db-test/find-block-by-content @conn "existing :number to :default"))))
             "existing :number property value correctly saved as :default")
 
-        (is (= {:block/schema {:type :default} :db/cardinality :db.cardinality/many}
-               (select-keys (d/entity @conn :user.property/people) [:block/schema :db/cardinality]))
+        (is (= {:property/type :default :db/cardinality :db.cardinality/many}
+               (select-keys (d/entity @conn :user.property/people) [:property/type :db/cardinality]))
             ":node property to :default value changes to :default and keeps existing cardinality")
         (is (= #{"[[Jakob]] [[Gabriel]]"}
                (:user.property/people (readable-properties @conn (db-test/find-block-by-content @conn ":node people"))))

+ 1 - 1
deps/outliner/src/logseq/outliner/pipeline.cljs

@@ -152,7 +152,7 @@
 (defn db-rebuild-block-refs
   "Rebuild block refs for DB graphs"
   [db block]
-  (let [private-built-in-props (set (keep (fn [[k v]] (when-not (get-in v [:schema :public?]) k))
+  (let [private-built-in-props (set (keep (fn [[k v]] (when-not (:property/public? v) k))
                                           db-property/built-in-properties))
         ;; explicit lookup in order to be nbb compatible
         properties (->

+ 12 - 12
deps/outliner/test/logseq/outliner/property_test.cljs

@@ -1,21 +1,21 @@
 (ns logseq.outliner.property-test
   (:require [cljs.test :refer [deftest is testing are]]
             [datascript.core :as d]
-            [logseq.outliner.property :as outliner-property]
+            [logseq.db :as ldb]
             [logseq.db.frontend.property :as db-property]
             [logseq.db.test.helper :as db-test]
-            [logseq.db :as ldb]))
+            [logseq.outliner.property :as outliner-property]))
 
 (deftest upsert-property!
   (testing "Creates a property"
     (let [conn (db-test/create-conn-with-blocks [])
           _ (outliner-property/upsert-property! conn nil {:type :number} {:property-name "num"})]
-      (is (= {:type :number}
-             (:block/schema (d/entity @conn :user.property/num)))
+      (is (= :number
+             (:property/type (d/entity @conn :user.property/num)))
           "Creates property with property-name")))
 
   (testing "Updates a property"
-    (let [conn (db-test/create-conn-with-blocks {:properties {:num {:block/schema {:type :number}}}})
+    (let [conn (db-test/create-conn-with-blocks {:properties {:num {:property/type :number}}})
           _ (outliner-property/upsert-property! conn :user.property/num {:type :default :cardinality :many} {})]
       (is (db-property/many? (d/entity @conn :user.property/num)))))
 
@@ -25,8 +25,8 @@
       (outliner-property/upsert-property! conn nil {} {:property-name "p1"})
       (outliner-property/upsert-property! conn nil {} {:property-name "p1"})
 
-      (is (= {:block/name "p1" :block/title "p1" :block/schema {:type :default}}
-             (select-keys (d/entity @conn :user.property/p1) [:block/name :block/title :block/schema]))
+      (is (= {:block/name "p1" :block/title "p1" :property/type :default}
+             (select-keys (d/entity @conn :user.property/p1) [:block/name :block/title :property/type]))
           "Existing db/ident does not get modified")
       (is (= "p1"
              (:block/title (d/entity @conn :user.property/p1-1)))
@@ -40,7 +40,7 @@
     (let [test-uuid (random-uuid)]
       (are [x y]
            (= (let [[schema-type value] x]
-                (outliner-property/convert-property-input-string nil {:block/schema {:type schema-type}} value)) y)
+                (outliner-property/convert-property-input-string nil {:property/type schema-type} value)) y)
         [:number "1"] 1
         [:number "1.2"] 1.2
         [:url test-uuid] test-uuid
@@ -210,7 +210,7 @@
 (deftest upsert-closed-value!
   (let [conn (db-test/create-conn-with-blocks
               {:properties {:num {:build/closed-values [{:uuid (random-uuid) :value 2}]
-                                  :block/schema {:type :number}}}})]
+                                  :property/type :number}}})]
 
     (testing "Add non-number choice shouldn't work"
       (is
@@ -248,7 +248,7 @@
         conn (db-test/create-conn-with-blocks
               {:properties {:default {:build/closed-values [{:uuid closed-value-uuid :value "foo"}
                                                             {:uuid used-closed-value-uuid :value "bar"}]
-                                      :block/schema {:type :default}}}
+                                      :property/type :default}}
                :pages-and-blocks
                [{:page {:block/title "page1"}
                  :blocks [{:block/title "b1" :user.property/default [:block/uuid used-closed-value-uuid]}]}]})
@@ -260,8 +260,8 @@
 (deftest class-add-property!
   (let [conn (db-test/create-conn-with-blocks
               {:classes {:c1 {}}
-               :properties {:p1 {:block/schema {:type :default}}
-                            :p2 {:block/schema {:type :default}}}})
+               :properties {:p1 {:property/type :default}
+                            :p2 {:property/type :default}}})
         _ (outliner-property/class-add-property! conn :user.class/c1 :user.property/p1)
         _ (outliner-property/class-add-property! conn :user.class/c1 :user.property/p2)]
     (is (= [:user.property/p1 :user.property/p2]

+ 3 - 3
deps/outliner/test/logseq/outliner/validate_test.cljs

@@ -7,8 +7,8 @@
 
 (deftest validate-block-title-unique-for-properties
   (let [conn (db-test/create-conn-with-blocks
-              {:properties {:color {:block/schema {:type :default}}
-                            :color2 {:block/schema {:type :default}}}})]
+              {:properties {:color {:property/type :default}
+                            :color2 {:property/type :default}}})]
 
     (is (nil?
          (outliner-validate/validate-unique-by-name-tag-and-block-type
@@ -67,7 +67,7 @@
 
 (deftest validate-parent-property
   (let [conn (db-test/create-conn-with-blocks
-              {:properties {:prop1 {:block/schema {:type :default}}}
+              {:properties {:prop1 {:property/type :default}}
                :classes {:Class1 {} :Class2 {}}
                :pages-and-blocks
                [{:page {:block/title "page1"}}

+ 15 - 14
scripts/src/logseq/tasks/db_graph/create_graph_with_properties.cljs

@@ -2,18 +2,18 @@
   "Script that generates all the permutations of property types and cardinality.
    Also creates a page of queries that exercises most properties
    NOTE: This script is also used in CI to confirm graph creation works"
-  (:require [logseq.outliner.cli :as outliner-cli]
-            [logseq.common.util.date-time :as date-time-util]
-            [logseq.common.util :as common-util]
-            [logseq.common.util.page-ref :as page-ref]
-            [logseq.db.frontend.property.type :as db-property-type]
-            [clojure.string :as string]
+  (:require ["os" :as os]
+            ["path" :as node-path]
+            [babashka.cli :as cli]
             [clojure.edn :as edn]
             [clojure.set :as set]
+            [clojure.string :as string]
             [datascript.core :as d]
-            ["path" :as node-path]
-            ["os" :as os]
-            [babashka.cli :as cli]
+            [logseq.common.util :as common-util]
+            [logseq.common.util.date-time :as date-time-util]
+            [logseq.common.util.page-ref :as page-ref]
+            [logseq.db.frontend.property.type :as db-property-type]
+            [logseq.outliner.cli :as outliner-cli]
             [nbb.classpath :as cp]
             [nbb.core :as nbb]))
 
@@ -168,16 +168,17 @@
      :properties
      (->> db-property-type/user-built-in-property-types
           (mapcat #(cond-> (if (= :node %)
-                             [[% {:block/schema {:type %} :build/schema-classes [:TestClass]}]
-                              [:node-without-classes {:block/schema {:type %}}]]
-                             [[% {:block/schema {:type %}}]])
+                             [[% {:property/type % :build/schema-classes [:TestClass]}]
+                              [:node-without-classes {:property/type %}]]
+                             [[% {:property/type %}]])
                      (contains? db-property-type/cardinality-property-types %)
                      (conj [(keyword (str (name %) "-many"))
-                            (cond-> {:block/schema {:type % :cardinality :many}}
+                            (cond-> {:property/type %
+                                     :db/cardinality :many}
                               (= :node %)
                               (assoc :build/schema-classes [:TestClass]))])))
           (into (mapv #(vector (keyword (str (name %) "-closed"))
-                               {:block/schema {:type %}
+                               {:property/type %
                                 :build/closed-values (closed-values-config (keyword (str (name %) "-closed")))})
                       [:default :url :number]))
           (into {}))}))

+ 19 - 19
scripts/src/logseq/tasks/db_graph/create_graph_with_schema_org.cljs

@@ -10,20 +10,20 @@
      * Some properties are skipped because they are superseded/deprecated or because they have a property
        type logseq doesnt' support yet
      * schema.org assumes no cardinality. For now, only :node properties are given a :cardinality :many"
-  (:require [logseq.outliner.cli :as outliner-cli]
-            [logseq.db.frontend.property :as db-property]
-            [clojure.string :as string]
-            [clojure.edn :as edn]
-            [datascript.core :as d]
-            ["path" :as node-path]
+  (:require ["fs" :as fs]
             ["os" :as os]
-            ["fs" :as fs]
-            [nbb.classpath :as cp]
-            [nbb.core :as nbb]
+            ["path" :as node-path]
+            [babashka.cli :as cli]
+            [clojure.edn :as edn]
             [clojure.set :as set]
+            [clojure.string :as string]
             [clojure.walk :as w]
-            [babashka.cli :as cli]
-            [logseq.db.frontend.malli-schema :as db-malli-schema]))
+            [datascript.core :as d]
+            [logseq.db.frontend.malli-schema :as db-malli-schema]
+            [logseq.db.frontend.property :as db-property]
+            [logseq.outliner.cli :as outliner-cli]
+            [nbb.classpath :as cp]
+            [nbb.core :as nbb]))
 
 (defn- get-comment-string
   [rdfs-comment renamed-pages]
@@ -113,16 +113,15 @@
 
         inverted-renamed-properties (set/map-invert renamed-properties)
         class-name (strip-schema-prefix (property-m "@id"))
-        url (str "https://schema.org/" (get inverted-renamed-properties class-name class-name))
-        schema (cond-> {:type schema-type}
-                 ;; This cardinality rule should be adjusted as we use schema.org more
-                 (= schema-type :node)
-                 (assoc :cardinality :many))]
+        url (str "https://schema.org/" (get inverted-renamed-properties class-name class-name))]
     {(keyword (strip-schema-prefix (property-m "@id")))
-     (cond-> {:block/schema schema
+     (cond-> {:property/type schema-type
               :build/properties (cond-> {:url url}
                                   (property-m "rdfs:comment")
                                   (assoc :logseq.property/description (get-comment-string (property-m "rdfs:comment") renamed-pages)))}
+       ;; This cardinality rule should be adjusted as we use schema.org more
+       (= schema-type :node)
+       (assoc :db/cardinality :many)
        (= schema-type :node)
        (assoc :build/schema-classes (mapv (comp keyword strip-schema-prefix) range-includes)))}))
 
@@ -260,7 +259,8 @@
    (apply merge
           (mapv #(->property-page % class-map options) select-properties))
    ;; Have to update schema for now as validation doesn't take into account existing properties
-   :logseq.property/description {:block/schema {:public? true :type :default}
+   :logseq.property/description {:property/public? true
+                                 :property/type :default
                                  :build/properties {:url "https://schema.org/description"
                                                     :logseq.property/description "A description of the item."}}))
 
@@ -377,7 +377,7 @@
                             (map (fn [m]
                                    (let [props (->> (db-property/properties m)
                                                     (into {}))]
-                                     (cond-> (select-keys m [:block/name :block/tags :block/title :block/schema :db/ident
+                                     (cond-> (select-keys m [:block/name :block/tags :block/title :property/type :db/cardinality :db/ident
                                                              :logseq.property.class/properties :logseq.property/parent
                                                              :db/cardinality :property/schema.classes :block/refs])
                                        (seq props)

+ 7 - 6
src/main/frontend/components/property.cljs

@@ -72,7 +72,8 @@
                           default-open? class-schema?]
                    :as opts}]
   (let [property-name (or (and *property-name @*property-name) (:block/title property))
-        property-schema (or (and *property-schema @*property-schema) (:block/schema property))
+        property-schema (or (and *property-schema @*property-schema)
+                            (select-keys property [:property/type]))
         schema-types (->> (concat db-property-type/user-built-in-property-types
                                   (when built-in?
                                     db-property-type/internal-built-in-property-types))
@@ -87,7 +88,7 @@
         :on-value-change
         (fn [v]
           (let [type (keyword (string/lower-case v))
-                update-schema-fn #(assoc % :type type)]
+                update-schema-fn #(assoc % :property/type type)]
             (when *property-schema
               (swap! *property-schema update-schema-fn))
             (let [schema (or (and *property-schema @*property-schema)
@@ -101,7 +102,7 @@
                 (p/do!
                  (when *show-new-property-config?
                    (reset! *show-new-property-config? false))
-                 (when (= (:type schema) :node) (reset! *show-class-select? true))
+                 (when (= (:property/type schema) :node) (reset! *show-class-select? true))
                  (db-property-handler/upsert-property!
                   (:db/ident property)
                   schema
@@ -127,8 +128,8 @@
                    (pv/<create-new-block! block property "")))))))}
 
         ;; only set when in property configure modal
-        (and *property-name (:type property-schema))
-        (assoc :default-value (name (:type property-schema))))
+        (and *property-name (:property/type property-schema))
+        (assoc :default-value (name (:property/type property-schema))))
       (shui/select-trigger
        {:class "!px-2 !py-0 !h-8"}
        (shui/select-value
@@ -375,7 +376,7 @@
      (if property-key
        [:div.ls-property-add.gap-1.flex.flex-1.flex-row.items-center
         [:div.flex.flex-row.items-center.property-key.gap-1
-         (when-not (:db/id property) (property-icon property (:type @*property-schema)))
+         (when-not (:db/id property) (property-icon property (:property/type @*property-schema)))
          (if (:db/id property)                              ; property exists already
            (property-key-cp block property opts)
            [:div property-key])]

+ 6 - 6
src/test/frontend/db/db_based_model_test.cljs

@@ -1,13 +1,13 @@
 (ns frontend.db.db-based-model-test
   (:require [cljs.test :refer [use-fixtures deftest is testing]]
-            [frontend.db.model :as model]
+            [datascript.core :as d]
             [frontend.db :as db]
+            [frontend.db.conn :as conn]
+            [frontend.db.model :as model]
             [frontend.test.helper :as test-helper]
-            [datascript.core :as d]
-            [logseq.db.frontend.class :as db-class]
             [logseq.db :as ldb]
-            [logseq.db.test.helper :as db-test]
-            [frontend.db.conn :as conn]))
+            [logseq.db.frontend.class :as db-class]
+            [logseq.db.test.helper :as db-test]))
 
 (def repo test-helper/test-db-name-db-version)
 
@@ -56,7 +56,7 @@
 
 (deftest get-classes-with-property-test
   (let [conn (db-test/create-conn-with-blocks
-              {:properties {:prop1 {:block/schema {:type :default}}}
+              {:properties {:prop1 {:property/type :default}}
                :classes
                {:Class1 {:build/schema-properties [:prop1]}
                 :Class2 {:build/schema-properties [:prop1]}}})

+ 4 - 4
src/test/frontend/db/query_dsl_test.cljs

@@ -183,7 +183,7 @@ prop-d:: [[nada]]"}])
   (deftest db-only-block-property-queries
     (load-test-files-for-db-graph
      {:properties
-      {:zzz {:block/schema {:type :default}
+      {:zzz {:property/type :default
              :block/title "zzz name!"}}
       :pages-and-blocks
       [{:page {:block/title "page1"}
@@ -208,7 +208,7 @@ prop-d:: [[nada]]"}])
   (deftest property-default-type-default-value-queries
     (load-test-files-for-db-graph
      {:properties
-      {:default {:block/schema {:type :default}
+      {:default {:property/type :default
                  :build/properties
                  {:logseq.property/default-value "foo"}
                  :build/properties-ref-types {:entity :number}}}
@@ -235,7 +235,7 @@ prop-d:: [[nada]]"}])
   (deftest property-checkbox-type-default-value-queries
     (load-test-files-for-db-graph
      {:properties
-      {:checkbox {:block/schema {:type :checkbox}
+      {:checkbox {:property/type :checkbox
                   :build/properties
                   {:logseq.property/scalar-default-value true}}}
       :classes {:Class1 {:build/schema-properties [:checkbox]}}
@@ -261,7 +261,7 @@ prop-d:: [[nada]]"}])
   (deftest closed-property-default-value-queries
     (load-test-files-for-db-graph
      {:properties
-      {:status {:block/schema {:type :default}
+      {:status {:property/type :default
                 :build/closed-values
                 [{:value "Todo" :uuid (random-uuid)}
                  {:value "Doing" :uuid (random-uuid)}]

+ 4 - 4
src/test/frontend/worker/handler/page/db_based/page_test.cljs

@@ -1,9 +1,9 @@
 (ns frontend.worker.handler.page.db-based.page-test
   (:require [cljs.test :refer [deftest is testing]]
             [datascript.core :as d]
-            [logseq.db.test.helper :as db-test]
+            [frontend.worker.handler.page.db-based.page :as worker-db-page]
             [logseq.db :as ldb]
-            [frontend.worker.handler.page.db-based.page :as worker-db-page]))
+            [logseq.db.test.helper :as db-test]))
 
 (deftest create-class
   (let [conn (db-test/create-conn)
@@ -18,7 +18,7 @@
 
 (deftest create-namespace-pages
   (let [conn (db-test/create-conn-with-blocks
-              {:properties {:property1 {:block/schema {:type :default}}}
+              {:properties {:property1 {:property/type :default}}
                :classes {:class1 {}}
                :pages-and-blocks [{:page {:block/title "page1"}}]})]
 
@@ -97,4 +97,4 @@
            (->> (d/entity @conn [:block/uuid page-uuid])
                 :block/tags
                 (map #(:db/ident (d/entity @conn (:db/id %))))))
-        "New journal only has Journal tag")))
+        "New journal only has Journal tag")))

+ 1 - 1
src/test/frontend/worker/rtc/client_test.cljs

@@ -45,7 +45,7 @@
                                    :db/valueType :db.type/ref
                                    :block/updated-at 1716880036491
                                    :block/created-at 1716880036491
-                                   :block/schema {:type :number}
+                                   :property/type :number
                                    :db/cardinality :db.cardinality/one
                                    :db/ident :user.property/xxx,
                                    :block/type "property",

+ 1 - 2
src/test/frontend/worker/rtc/db_listener_test.cljs

@@ -49,7 +49,7 @@
                    [:db/add 1000000 :db/valueType :db.type/ref]
                    [:db/add 1000000 :block/updated-at 1716882111476]
                    [:db/add 1000000 :block/created-at 1716882111476]
-                   [:db/add 1000000 :block/schema {:type :number}]
+                   [:db/add 1000000 :property/type :number]
                    [:db/add 1000000 :db/cardinality :db.cardinality/one]
                    [:db/add 1000000 :db/ident :user.property/qqq]
                    [:db/add 1000000 :block/tags :logseq.class/Property]
@@ -71,7 +71,6 @@
                        [:db/valueType "[\"~#'\",\"~:db.type/ref\"]"]
                        [:block/updated-at "[\"~#'\",1716882111476]"]
                        [:block/created-at "[\"~#'\",1716882111476]"]
-                       [:block/schema "[\"^ \",\"~:type\",\"~:number\"]"]
                        [:block/tags #uuid "00000002-1038-7670-4800-000000000000"]
                        [:block/title "[\"~#'\",\"qqq\"]"]
                        [:db/cardinality "[\"~#'\",\"~:db.cardinality/one\"]"]