Pārlūkot izejas kodu

fix: db lint and tests from #10683

Gabriel Horner 1 gadu atpakaļ
vecāks
revīzija
ff5430cfd7

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

@@ -12,7 +12,7 @@
        vec))
 
 (defn restore-initial-data
-  "Given initial sqlite data, returns a datascript connection"
+  "Given initial sqlite data and schema, returns a datascript connection"
   [datoms schema]
   (d/conn-from-datoms datoms schema))
 

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

@@ -1,7 +1,6 @@
 (ns ^:node-only logseq.db.sqlite.db
   "Sqlite fns for db graphs"
-  (:require ["path" :as node-path]
-            ["better-sqlite3" :as sqlite3]
+  (:require ["better-sqlite3" :as sqlite3]
             [logseq.db.sqlite.common-db :as sqlite-common-db]
             ;; FIXME: datascript.core has to come before datascript.storage or else nbb fails
             #_:clj-kondo/ignore

+ 3 - 2
deps/db/test/logseq/db/sqlite/db_test.cljs

@@ -4,6 +4,7 @@
             ["path" :as node-path]
             [datascript.core :as d]
             [logseq.db.sqlite.common-db :as sqlite-common-db]
+            [logseq.db.frontend.schema :as db-schema]
             [logseq.db.sqlite.db :as sqlite-db]))
 
 (use-fixtures
@@ -32,7 +33,7 @@
           _ (d/transact! conn* blocks)
           ;; Simulate getting data from sqlite and restoring it for frontend
           conn (-> (sqlite-common-db/get-initial-data @conn*)
-                   sqlite-common-db/restore-initial-data)]
+                   (sqlite-common-db/restore-initial-data db-schema/schema-for-db-based-graph))]
       (is (= blocks
              (->> @conn
                   (d/q '[:find (pull ?b [:block/uuid :file/path :file/content]) :where [?b :file/content]])
@@ -61,7 +62,7 @@
           _ (d/transact! conn* blocks)
           ;; Simulate getting data from sqlite and restoring it for frontend
           conn (-> (sqlite-common-db/get-initial-data @conn*)
-                   sqlite-common-db/restore-initial-data)]
+                   (sqlite-common-db/restore-initial-data db-schema/schema-for-db-based-graph))]
       (is (= blocks
              (->> (d/q '[:find (pull ?b [*])
                          :where [?b :block/created-at]]