yenu/_scripts/migration.clj

14 lines
441 B
Clojure
Raw Normal View History

2018-03-20 21:33:32 +01:00
(ns yenu.db.migration
(:require [yenu.helpers.images :as image]
[me.raynes.fs :as fs]
[yenu.db.core :as db]))
(defn migrate-image [image-path]
(let [new-id (fs/base-name image-path true)
hash (image/scale-image-and-save image-path)]
(db/set-image-hash {:hash hash :id new-id})))
(defn start-migration []
(let [images (fs/list-dir (image/data-path "to-process"))]
(run! migrate-image images)))