     (if (not created) ; already stopped
       this
       (do
-        (cleanup-db-fixture (:path config))
+        (cleanup-db-fixture (:file config))
         (assoc this :created false)))))
 
 (defn new-db-fixture []

; ------------------------------------------------------------------------------

(defn gen-db-fixture-config []
  (let [unique (gensym)
        path   (str "./data/test-db-" unique)]
    {:path path
     :rw (str "jdbc:h2:file:" path ";MODE=MySQL;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=1")
     :ro (str "jdbc:h2:file:" path ";MODE=MySQL;TRACE_LEVEL_FILE=0;TRACE_LEVEL_SYSTEM_OUT=1;ACCESS_MODE_DATA=r")}))


    :up   (log/debug "Applying" id)
    :down (log/debug "Rolling back" id)))

(defn cleanup-db-fixture [file]
  (log/info "deleting temporaray test database: " (.getAbsolutePath file))
  (io/delete-file file))

(defrecord DatabaseFixture [config created]
  component/Lifecycle
