   (:require [clojure.tools.logging :as log]
             [clojure.java.jdbc :as jdbc]
             [sql-file.script :as script]))
-
-(defn- fail [ & args ]
-  (throw (Exception. (apply str args))))
 
 (defn- locate-schema-script [ conn basename ]
   (or (some identity

the specified schema is available within that database."
  (let [ conn (conn-assoc-schema conn schema) ]
    (log/info "Opening sql-file:" conn)
    (conn-ensure-schemas conn)))

;; HSQLDB Specific


      (safe-run-script conn (schema-migrate-script conn [ schema-name to-version ]))
      (set-schema-version! conn schema-name to-version))))

(defn- conn-assoc-schema [ conn schema ]
  "Add a sql-file schema to the connection map."
  (assoc conn
    :sql-file-schemas
    (conj (get conn :sql-file-schemas [])
          schema)))

(defn- ensure-schema [ conn schema ]
  "Locate and run the scripts necessary to install the specified
schema in the target database instance."
  (log/debug "Ensuring schema:" schema)
  (let [conn (conn-assoc-schema conn schema)
        [req-schema-name req-schema-version] schema
        cur-schema-version (get-schema-version conn req-schema-name)]
      (cond
        (nil? cur-schema-version)
