 (ns metabase.cmd.load-from-h2
   "Commands for loading data from an H2 file into another database."
-  (:require [colorize.core :as color]
+  (:require [clojure.java.jdbc :as jdbc]
+            [clojure.set :as set]
+            [colorize.core :as color]
             (korma [core :as k]
                    [db :as kdb])
+            [metabase.config :as config]
             [metabase.db :as db]
             (metabase.models [activity :refer [Activity]]
                              [card :refer [Card]]

    ;; then insert the rest, which should be safe to insert now
    (insert-entity e self-referencing)))

(defn load-from-h2
  "Transfer data from existing H2 database to the newly created (presumably MySQL or Postgres) DB specified by env vars.
   Intended as a tool for upgrading from H2 to a 'real' Database.

             :when (seq objs)]
       (if-not (contains? #{RawColumn Field} e)
         (insert-entity e objs)
         (insert-self-referencing-entity e objs))))

    ;; if we are loading into a postgres db then we need to update sequence nextvals
    (when (= (config/config-str :mb-db-type) "postgres")
      (set-postgres-sequence-values))))
