                update-row (apply juxt (comp sutils/munge-hash-for-storage
                                             hash/report-identity-hash)
                                  old-cols)
-               insert->hash (fn [batch]
-                              (swap! reports-migrated + (count batch))
-                              (let [batch (map update-row batch)]
-                                (when (seq batch)
-                                  (doseq [g (group-by (fn [o] (-> (get o 15) ;; producer_timestamp
-                                                                  (partitioning/to-zoned-date-time)
-                                                                  (partitioning/date-suffix))) batch)]
-                                    (jdbc/insert-multi! (str "reports_" (first g))
-                                                        new-cols
-                                                        (last g)))) )
-
+               insert->hash (fn [row]
+                              (swap! reports-migrated inc)
+                              (let [updated-row (update-row row)
+                                    table-name (str "reports_" (-> updated-row
+                                                                   (get 15) ;; producer_timestamp
+                                                                   (partitioning/to-zoned-date-time)
+                                                                   (partitioning/date-suffix)))]
+                                (jdbc/insert! table-name new-cols updated-row))
                               (let [now (.getTime (java.util.Date.))]
                                 (when (> (- now @last-logged) 60000)
                                   (maplog :info
                                           {:migration 74 :at @reports-migrated :of event-count}
                                           #(trs "Migrated {0} of {1} reports" (:at %) (:of %)))
                                   (reset! last-logged now))))]
-           (dorun (map insert->hash (partition batch-size batch-size [] rows)))))))
+           (run! insert->hash rows)))))
 
    ;; migrate data
 

   "DROP TABLE resource_events_premigrate"
   "DROP FUNCTION find_resource_events_unique_dates()")))

(defn reports-partitioning
  ([]
   (reports-partitioning 500))
  ([batch-size]

   (jdbc/do-commands
     ;; detach the sequence so it isn't modified during the migration
     "ALTER SEQUENCE reports_id_seq OWNED BY NONE"


      "  ADD CONSTRAINT reports_status_fkey FOREIGN KEY (status_id) REFERENCES report_statuses(id) ON DELETE CASCADE"]

     "DROP TABLE reports_premigrate"
     "DROP FUNCTION find_reports_unique_dates()"))

(def migrations
  "The available migrations, as a map from migration version to migration function."
