Browse Source

chore: remove unused :file/handle

Tienson Qin 1 year ago
parent
commit
dec56b31f0

+ 3 - 7
deps/db/src/logseq/db/frontend/schema.cljs

@@ -107,20 +107,16 @@
 
    ;; file
    :file/path {:db/unique :db.unique/identity}
+   :file/content {}
    :file/created-at {}
    :file/last-modified-at {}
-   ;; only store the content of logseq's files
-   :file/content {}
-
-   ;; TODO: do we really use this?
-   :file/handle {}
-   ;; :file/size {}
+   :file/size {}
    })
 
 (def schema-for-db-based-graph
   (merge
    (dissoc schema
-           :block/namespace :block/properties-text-values :block/pre-block? :recent/pages :file/handle :block/file
+           :block/namespace :block/properties-text-values :block/pre-block? :recent/pages :block/file
            :block/properties :block/properties-order :block/repeated? :block/deadline :block/scheduled :block/priority
            :block/marker :block/macros)
    {:block/name {:db/index true}        ; remove db/unique for :block/name

+ 1 - 1
scripts/src/logseq/tasks/dev/db_and_file_graphs.clj

@@ -85,7 +85,7 @@
   []
   (let [file-concepts (->>
                        ;; from logseq.db.frontend.schema
-                       [:block/properties-text-values :block/pre-block :recent/pages :file/handle :block/file :block/properties-order
+                       [:block/properties-text-values :block/pre-block :recent/pages :block/file :block/properties-order
                         :block/marker :block/priority :block/scheduled :block/deadline :block/macros]
                        (map str)
                        (into [;; e.g. block/properties :title

+ 2 - 4
src/main/frontend/fs/nfs.cljs

@@ -157,8 +157,7 @@
                           :size        (.-size file)
                           :type        (.-kind (.-handle file))
                           :content     content
-                          :file/file   file
-                          :file/handle (.-handle file)})))))))
+                          :file/file   file})))))))
 
 (defrecord ^:large-vars/cleanup-todo Nfs []
   protocol/Fs
@@ -345,8 +344,7 @@
                                  :type        (.-kind (.-handle file))
                                  :content     content
                                  ;; expose the following, they are used by the file system
-                                 :file/file   file
-                                 :file/handle (.-handle file)}))))
+                                 :file/file   file}))))
             files (p/all files)]
       (add-nfs-file-handle! (str "handle/" dir-name) dir-handle)
       (idb/set-item! (str "handle/" dir-name) dir-handle)

+ 1 - 1
src/main/frontend/handler/file_based/nfs.cljs

@@ -212,7 +212,7 @@
                                           (:file/content file))]
                           (assoc file :file/content content)))) added-or-modified))
         (p/then (fn [result]
-                  (let [files (map #(dissoc % :file/file :file/handle) result)
+                  (let [files (map #(dissoc % :file/file) result)
                         [modified-files modified] (if re-index?
                                                     [files (set modified)]
                                                     (let [modified-files (filter (fn [file] (contains? added-or-modified (:file/path file))) files)]