 
 (defn execute-undo [{:keys [tenant-conn] :as deps} dataset-id job-execution-id]
   (let [current-dataset-version (db.transformation/latest-dataset-version-by-dataset-id tenant-conn
-                                                                      {:dataset-id dataset-id})
-        current-version (:version current-dataset-version)]
-    (if (= current-version 1)
-      (lib/created (assoc current-dataset-version :dataset-id dataset-id))
+                                                                      {:dataset-id dataset-id})]
+    (when (not= (:version current-dataset-version) 1)
       (apply-undo deps
                   dataset-id
                   job-execution-id

                                                                                                  columns))))
                                    :columns (w/keywordize-keys columns)}]
          (db.dataset-version/new-dataset-version tenant-conn next-dataset-version)
          (db.transformation/touch-dataset tenant-conn {:id dataset-id})
          (lib/created next-dataset-version))))))

(defn- apply-undo [{:keys [tenant-conn] :as deps} dataset-id job-execution-id current-dataset-version]
  (let [imported-table-name (:imported-table-name current-dataset-version)

            (db.dataset-version/new-dataset-version tenant-conn
                                 next-dataset-version)
            (db.transformation/touch-dataset tenant-conn {:id dataset-id})
            (db.transformation/drop-table tenant-conn {:table-name previous-table-name})))
        (let [transformation (assoc (first transformations) :dataset-id dataset-id)
              {:keys [success? message columns execution-log] :as transformation-result}
              (try-apply-operation deps table-name columns transformation)]
