mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
chore: remove bb task for validating previous sqlite data
This commit is contained in:
3
bb.edn
3
bb.edn
@@ -104,9 +104,6 @@
|
||||
dev:gen-malli-kondo-config
|
||||
logseq.tasks.dev/gen-malli-kondo-config
|
||||
|
||||
dev:validate-sqlite-data
|
||||
logseq.tasks.validate-sqlite-data/-main
|
||||
|
||||
lint:large-vars
|
||||
logseq.bb-tasks.lint.large-vars/-main
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
(ns logseq.tasks.validate-sqlite-data
|
||||
(:require [pod.babashka.go-sqlite3 :as sqlite]
|
||||
[babashka.fs :as fs]))
|
||||
|
||||
(defn get-all-normal-blocks
|
||||
[db-path]
|
||||
(sqlite/query db-path "select * from blocks where type = 1"))
|
||||
|
||||
|
||||
(defn get-all-page-blocks
|
||||
[db-path]
|
||||
(sqlite/query db-path "select * from blocks where type = 2"))
|
||||
|
||||
|
||||
|
||||
(defn all-normal-blocks-have-page-uuid
|
||||
[all-page-blocks all-normal-blocks]
|
||||
(let [page-block-uuids (set (mapv :uuid all-page-blocks))]
|
||||
(loop [[b & others] all-normal-blocks]
|
||||
(when b
|
||||
(assert (and (:uuid b) (contains? page-block-uuids (:page_uuid b))) b)
|
||||
(recur others)))))
|
||||
|
||||
(defn -main
|
||||
[& args]
|
||||
(prn args)
|
||||
(let [db-graph-name (first args)
|
||||
db-path (str (fs/path (fs/home) "logseq" "graphs" db-graph-name))]
|
||||
(assert (fs/exists? db-path) db-path)
|
||||
(let [all-page-blocks (get-all-page-blocks db-path)
|
||||
all-normal-blocks (get-all-normal-blocks db-path)]
|
||||
(all-normal-blocks-have-page-uuid all-page-blocks all-normal-blocks))))
|
||||
Reference in New Issue
Block a user