 (defn- set-postgres-sequence-values []
   (print (u/format-color 'blue "Setting postgres sequence ids to proper values..."))
   (flush)
-  (jdbc/with-db-transaction [conn (db/jdbc-details @db/db-connection-details)]
-    (doseq [e    (filter #(not (contains? entities-without-autoinc-ids %)) entities)
-            :let [table-name (:table e)
-                  seq-name   (str table-name "_id_seq")
-                  sql        (format "SELECT setval('%s', COALESCE((SELECT MAX(id) FROM %s), 1), true) as val" seq-name table-name)]]
-      (jdbc/db-query-with-resultset conn [sql] :val)))
+  (doseq [e    (filter #(not (contains? entities-without-autoinc-ids %)) entities)
+          :let [table-name (:table e)
+                seq-name   (str table-name "_id_seq")
+                sql        (format "SELECT setval('%s', COALESCE((SELECT MAX(id) FROM %s), 1), true) as val" seq-name table-name)]]
+    (jdbc/db-query-with-resultset *db-conn* [sql] :val))
   (println (color/green "[OK]")))
 
 (defn load-from-h2


    ;; 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))))

  "Entities that do NOT use an auto incrementing ID column."
  #{Setting Session})

(def ^:private ^:dynamic *db-conn*
  "Active database connection to the target database we are loading into."
  nil)

(defn- insert-entity [e objs]
  (print (u/format-color 'blue "Transfering %d instances of %s..." (count objs) (:name e)))
  (flush)
