Преглед изворни кода

fix: allow properties to use rename-db-idents

Tienson Qin пре 1 месец
родитељ
комит
390bf94ca3

+ 6 - 5
src/main/frontend/worker/db/migrate.cljs

@@ -114,11 +114,12 @@
 
 (defn- rename-properties
   [props-to-rename {:keys [fix]}]
-  {:rename-db-idents (mapv
-                      (fn [[old-ident new-ident]]
-                        {:db-ident-or-block-uuid old-ident
-                         :new-db-ident new-ident})
-                      props-to-rename)
+  {:rename-db-idents (fn [_db]
+                       (mapv
+                        (fn [[old-ident new-ident]]
+                          {:db-ident-or-block-uuid old-ident
+                           :new-db-ident new-ident})
+                        props-to-rename))
    :fix (fn [db]
           (let [common-fix (rename-properties-fix db
                                                   {:logseq.property.asset/external-src

+ 2 - 2
src/main/frontend/worker/db/rename_db_ident.cljs

@@ -23,8 +23,8 @@
                                             [:block/uuid db-ident-or-block-uuid]))
                          old-db-ident (:db/ident ent)]]
                (do (when (some? ent)
-                     (when-not (ldb/class? ent)
-                       (throw (ex-info "Only entities of class type support :rename-db-ident" {:ent (into {} ent)})))
+                     (when-not (or (ldb/class? ent) (ldb/property? ent))
+                       (throw (ex-info "Only entities of class or property type support :rename-db-ident" {:ent (into {} ent)})))
                      (swap! *rename-db-idents-coll conj rename-db-ident))
                    (cons {:db/id (:db/id ent) :db/ident new-db-ident}
                          (some->> old-db-ident