   {:pre [(db? db) (report? report)]}
   (go-pair
     (let [initial-report report
-          {tx :tx}       report]
+          {tx :tx}       report
+          schema         (schema db)]
       (loop [report initial-report
              es (:entities initial-report)]
         (let [[[op e a v :as entity] & entities] es]

  ;; TODO: constrain entities; constrain attributes.

  (go-pair
    (doseq [[op e a v] (:entities report)]
      (ds/ensure-valid-value (schema db) a v))
    report))

(defn- <ensure-unique-constraints

            report

            (= op :db/add)
            (if (ds/multival? schema a)
              (if (empty? (<? (<eavt db [e a v])))
                (recur (transact-report report (datom e a v tx true)) entities)
                (recur report entities))
