   (str "migrations/" (name plugin) "/seed"))
 
 
-(defn seed-insert [ds data-file]
+(defn seed-insert [conf data-file]
   (doseq [seed (-> data-file slurp read-string)]
-    (jdbc/insert! (jdbc-uri ds) (:table seed) (:data seed))))
+    (jdbc/insert! (jdbc-uri conf) (:table seed) (:data seed))))
 
 
 (defn copy-file [source-path dest-path]

(defn migrate [& args]
  (doseq [plugin (or args (plugins))]
    (log/info "running migrations for plugin" (name plugin))
    (migratus/migrate (migratus-config (dev-ds) plugin)))
  (System/exit 0))

(defn rollback [plugin]
  (when-let [id (last (applied-migrations (dev-ds) plugin))]
    (log/info "rolling back latest migration for plugin" (name plugin))
    (run-down dev-ds plugin [id]))
  (System/exit 0))

(defn remove-plugin [plugin]
  (log/info "rolling back all migrations for plugin" (name plugin))
  (let [applied (reverse (applied-migrations (dev-ds) plugin))]
    (run-down (dev-ds) plugin applied))
  (System/exit 0))

(defn seed [& args]
  (doseq [plugin (or args (plugins))]
    (run-seed (dev-ds) plugin))
  (System/exit 0))

(defn reset [& args]
  (doseq [plugin (or args (plugins))]
    (run-reset (dev-ds) plugin))
  (System/exit 0))


(defn plugins [] (cons :core (:plugins (dev-config))))


(defn jdbc-uri [conf]
  (let [source (:datasource conf)]
    (str "jdbc:" (:adapter source "mysql") "://"
         (:server-name source "localhost")  "/" (:database-name source)
         "?user=" (:username source)
         (if (not-empty (:password source)) (str "&password=" (:password source))))))


(def schema-table "schema_migrations")
