    :init maybe-create-schema-table
    :current-version current-db-version
    :update-version update-db-version })
-
-(comment
-  (let [result (int (inc (or (:msn (first (j/query db ["SELECT MAX(sequence_number) AS MSN FROM METADATA_DB.concept_id
-                             WHERE concept_type = ? AND provider_id = ? AND native_id = ?"
-                            "collection" "PROV1" "ABC"]))) 0)))])
-  )
(def db-host (get (System/getenv) "MDB_DB_HOST" "localhost"))
(def db-port (get (System/getenv) "MDB_DB_PORT" "1521"))
(def db-sid (get (System/getenv) "MDB_DB_SID" "orcl"))
    

(def db {:classname "oracle.jdbc.driver.OracleDriver"
         :subprotocol "oracle"

  [args]
  ;; wrap in a try-catch since there is not easy way to check for the existence of the DB
  (try
    (j/db-do-commands db "CREATE TABLE METADATA_DB.schema_version (version INTEGER NOT NULL, created_at TIMESTAMP(9) WITH TIME ZONE DEFAULT sysdate NOT NULL)")
    (catch Exception e)))

(defn current-db-version []
  (int (or (:version (first (j/query db ["select version from METADATA_DB.schema_version order by created_at desc"]))) 0)))

(defn update-db-version [version]
  (j/insert! db "METADATA_DB.schema_version" ["version"] [version])
  ; sleep a second to workaround timestamp precision issue
  (Thread/sleep 1000))

(defn migrate-config []
  {:directory "src/migrations/"
