mirror of https://github.com/logseq/logseq
fix: new db graph shouldn't have deprecated config.edn warnings
parent
faa5e43966
commit
9db7cd3be9
|
@ -1,7 +1,6 @@
|
|||
(ns frontend.components.imports
|
||||
"Import data into Logseq."
|
||||
(:require [borkdude.rewrite-edn :as rewrite]
|
||||
[cljs.core.async.interop :refer [p->c]]
|
||||
(:require [cljs.core.async.interop :refer [p->c]]
|
||||
[clojure.core.async :as async]
|
||||
[clojure.edn :as edn]
|
||||
[clojure.string :as string]
|
||||
|
@ -13,7 +12,6 @@
|
|||
[frontend.context.i18n :refer [t]]
|
||||
[frontend.db :as db]
|
||||
[frontend.fs :as fs]
|
||||
[frontend.handler.common.config-edn :as config-edn-common-handler]
|
||||
[frontend.handler.db-based.editor :as db-editor-handler]
|
||||
[frontend.handler.import :as import-handler]
|
||||
[frontend.handler.notification :as notification]
|
||||
|
@ -219,10 +217,7 @@
|
|||
(-> (when config-file
|
||||
(.text config-file))
|
||||
(p/then (fn [content]
|
||||
(let [migrated-content (-> (reduce rewrite/dissoc
|
||||
(rewrite/parse-string (str content))
|
||||
(keys config-edn-common-handler/file-only-config))
|
||||
str)]
|
||||
(let [migrated-content (repo-handler/migrate-db-config content)]
|
||||
(p/do!
|
||||
(db-editor-handler/save-file! "logseq/config.edn" migrated-content))
|
||||
(edn/read-string migrated-content))))))
|
||||
|
|
|
@ -103,8 +103,9 @@ nested keys or positional errors e.g. tuples"
|
|||
:block-hidden-properties
|
||||
"is not used in DB graphs as hiding a property is done in its configuration"
|
||||
:ignored-page-references-keywords
|
||||
"is not used in DB graphs"
|
||||
:file/name-format
|
||||
;; TODO: Remove key when default is changed
|
||||
;; "is not used in DB graphs"
|
||||
;; :file/name-format
|
||||
"is not used in DB graphs"
|
||||
:feature/enable-block-timestamps?
|
||||
"is not used in DB graphs as it is always enabled"})
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
[frontend.fs.nfs :as nfs]
|
||||
[frontend.handler.file :as file-handler]
|
||||
[frontend.handler.repo-config :as repo-config-handler]
|
||||
[frontend.handler.common.config-edn :as config-edn-common-handler]
|
||||
[frontend.handler.common.file :as file-common-handler]
|
||||
[frontend.handler.route :as route-handler]
|
||||
[frontend.handler.ui :as ui-handler]
|
||||
|
@ -35,7 +36,8 @@
|
|||
[clojure.core.async :as async]
|
||||
[frontend.mobile.util :as mobile-util]
|
||||
[medley.core :as medley]
|
||||
[logseq.common.path :as path]))
|
||||
[logseq.common.path :as path]
|
||||
[borkdude.rewrite-edn :as rewrite]))
|
||||
|
||||
;; Project settings should be checked in two situations:
|
||||
;; 1. User changes the config.edn directly in logseq.com (fn: alter-file)
|
||||
|
@ -104,7 +106,7 @@
|
|||
:else
|
||||
default-content)
|
||||
file-rpath (path/path-join (config/get-journals-directory) (str file-name "."
|
||||
(config/get-file-extension format)))
|
||||
(config/get-file-extension format)))
|
||||
page-exists? (db/entity repo-url [:block/name (util/page-name-sanity-lc title)])
|
||||
empty-blocks? (db/page-empty? repo-url (util/page-name-sanity-lc title))]
|
||||
(when (or empty-blocks? (not page-exists?))
|
||||
|
@ -518,13 +520,20 @@
|
|||
(let [full-graph-name (string/lower-case (str config/db-version-prefix graph-name))]
|
||||
(some #(= (some-> (:url %) string/lower-case) full-graph-name) (state/get-repos))))
|
||||
|
||||
(defn migrate-db-config
|
||||
[content]
|
||||
(-> (reduce rewrite/dissoc
|
||||
(rewrite/parse-string (str content))
|
||||
(keys config-edn-common-handler/file-only-config))
|
||||
str))
|
||||
|
||||
(defn- create-db [full-graph-name {:keys [file-graph-import?]}]
|
||||
(->
|
||||
(p/let [_ (persist-db/<new full-graph-name)
|
||||
_ (start-repo-db-if-not-exists! full-graph-name)
|
||||
_ (state/add-repo! {:url full-graph-name})
|
||||
_ (when-not file-graph-import? (route-handler/redirect-to-home!))
|
||||
initial-data (sqlite-create-graph/build-db-initial-data config/config-default-content)
|
||||
initial-data (sqlite-create-graph/build-db-initial-data (migrate-db-config config/config-default-content))
|
||||
_ (db/transact! full-graph-name initial-data)
|
||||
_ (repo-config-handler/set-repo-config-state! full-graph-name config/config-default-content)
|
||||
;; TODO: handle global graph
|
||||
|
|
Loading…
Reference in New Issue