              :when (seq objs)]
        (if-not (contains? #{RawColumn Field} e)
          (insert-entity e objs)
-         (insert-self-referencing-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))))

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

                             [table :refer [Table]]
                             [user :refer [User]]
                             [view-log :refer [ViewLog]])
            [metabase.util :as u]))

(def ^:private entities
  "Entities in the order they should be serialized/deserialized.
