adds the ability to start a restore from a particular entity
This commit is contained in:
@@ -104,7 +104,7 @@
|
||||
|
||||
(defn load-from-backup
|
||||
([backup-id connection] (load-from-backup backup-id connection nil))
|
||||
([backup-id connection item-list]
|
||||
([backup-id connection starting-at]
|
||||
(let [schema (edn/read-string (slurp (pull-file backup-id "schema.edn")))
|
||||
full-dependencies (edn/read-string (slurp (pull-file backup-id "full-dependencies.edn")))
|
||||
entity-dependencies (edn/read-string (slurp (pull-file backup-id "entity-dependencies.edn")))]
|
||||
@@ -124,7 +124,9 @@
|
||||
{:entity/migration-key 17592271516922}]})
|
||||
|
||||
|
||||
(doseq [entity (or item-list (filter (complement (conj @loaded "audit")) (order-of-insert entity-dependencies)))
|
||||
(doseq [entity (cond->> (order-of-insert entity-dependencies)
|
||||
true (filter #(not= "audit" %))
|
||||
starting-at (drop-while #(not= starting-at %)))
|
||||
:let [_ (reset! so-far 0)
|
||||
_ (mu/log ::querying :entity entity)
|
||||
entities (mu/trace ::file-pulled
|
||||
@@ -132,10 +134,10 @@
|
||||
(ednl/slurp (pull-file backup-id (str entity ".ednl"))))]]
|
||||
(load-entity entity entities)))))
|
||||
|
||||
(defn restore-fresh-from-backup [{:keys [backup]}]
|
||||
(defn restore-fresh-from-backup [{:keys [backup starting-at]}]
|
||||
(println "beginning")
|
||||
(mu/log ::beginning-restore)
|
||||
(load-from-backup backup auto-ap.datomic/conn)
|
||||
(load-from-backup backup auto-ap.datomic/conn starting-at)
|
||||
(mu/log ::restore-complete)
|
||||
(mu/log ::beginning-index-build)
|
||||
(auto-ap.datomic/transact-schema auto-ap.datomic/conn)
|
||||
|
||||
Reference in New Issue
Block a user