(defn ensure-relation
"If the database lacks the named relation, add it"
[db name keys indexes]
(if-let [rel (db name)]
(do
(assert (= (:schema rel) (set keys)))
db)
(let [db1 (add-relation db name keys)]
(reduce (fn [db key] (add-index db name key))
db1
indexes))))
Comments top
No comments for ensure-relation. Log in to add a comment.