mirror of
https://github.com/logseq/logseq.git
synced 2026-05-25 21:24:21 +00:00
fix: rebuild from datoms when db migration failed
This commit is contained in:
@@ -828,18 +828,21 @@
|
||||
(fn [col]
|
||||
(reduce
|
||||
(fn [col property]
|
||||
(mapv (fn [item]
|
||||
(if (and (vector? item) (= property (first item)))
|
||||
(let [[p o v] item
|
||||
f (fn [id]
|
||||
(let [new-ident (get new-idents (:db/ident (d/entity db [:block/uuid id])))]
|
||||
(common-uuid/gen-uuid :db-ident-block-uuid new-ident)))
|
||||
v' (if (set? v)
|
||||
(set (map f v))
|
||||
(f v))]
|
||||
[p o v'])
|
||||
item))
|
||||
col))
|
||||
(vec
|
||||
(keep (fn [item]
|
||||
(if (and (vector? item) (= property (first item)))
|
||||
(let [[p o v] item
|
||||
f (fn [id]
|
||||
(when-let [new-ident (get new-idents (:db/ident (d/entity db [:block/uuid id])))]
|
||||
(common-uuid/gen-uuid :db-ident-block-uuid new-ident)))
|
||||
v' (if (set? v)
|
||||
(when-let [v' (seq (keep f v))]
|
||||
(set v'))
|
||||
(f v))]
|
||||
(when v'
|
||||
[p o v']))
|
||||
item))
|
||||
col)))
|
||||
col
|
||||
[:logseq.task/status :logseq.task/priority])))]
|
||||
[:db/add (:e d) :logseq.property.table/filters value]))))))]
|
||||
|
||||
@@ -367,7 +367,7 @@
|
||||
|
||||
(catch :default e
|
||||
(log/error "DB migrate failed, error: " e)
|
||||
(if (and db-based? (= (:message e) "DB missing addresses"))
|
||||
(if (and db-based? (= (.-message e) "DB missing addresses"))
|
||||
(do
|
||||
(rebuild-db-from-datoms! conn db import-type)
|
||||
(db-migrate/migrate conn search-db))
|
||||
|
||||
Reference in New Issue
Block a user