        (map (fn [{:keys [updated_at body user_id]}]
               (when user_id ; some example versions don't have a user associated
                 (let [user (lookup-user user_id)]
-                  {:created-at updated_at
+                  {:created-at (.getTime updated_at)
                    :body body
-                   :user user}))))
+                   :editor user}))))
        (filter identity)
        (sort-by :created-at)
        #_reverse))

(defn all-notes []
  (j/query mysql-db ["SELECT * FROM comments"]))

(defn lookup-user [user-id]
  (select-keys (first (j/query mysql-db ["SELECT * FROM users WHERE id=?" user-id])) [:email :login]))

(defn lookup-ns [nsid]
  {:ns (->> (j/query mysql-db ["SELECT * FROM namespaces WHERE id=?" nsid])

     )


(defn import-notes []
  (let [notes (->> (all-notes)
                   (map #(assoc % :author (lookup-user (:user_id %))))
                   (map #(assoc % :var (lookup-function (:commentable_id %))))
                   (map #(assoc % :created-at (:created_at %)))
                   (map #(assoc % :updated-at (:updated_at %)))
                   (map (fn [{:keys [created-at updated-at] :as m}]
                          (assoc m
                            :created-at (when created-at (.getTime created-at))
                            :updated-at (when updated-at (.getTime updated-at)))))
                   (map #(select-keys % [:updated-at :var :body :created-at :author])))]
    (doseq [n notes]
      (data/update-note-where! #(select-keys % [:author :body :var]) n))))

#_(import-notes)
