(ns user (:require [clojure.java.io :as io] [clojure.tools.logging :as log] [clojure.tools.namespace.repl :as tn-repl] [com.biffweb.my-project :as main :refer [system]] [com.biffweb.my-project.util.db :as db] [honey.sql :as sql] [honey.sql.helpers :refer [drop-table]] [next.jdbc :as jdbc])) (defn reset-db! [] (let [{:keys [example/ds]} @system tables [:user :player] drop-statements (map (fn [table] (sql/format (drop-table :if-exists table))) tables)] (db/execute-all! ds drop-statements) (jdbc/execute! ds [(slurp (io/resource "migrations.sql"))]))) (defn refresh [] (doseq [f (:biff/stop @system)] (log/info "stopping:" (str f)) (f)) (tn-repl/refresh :after `main/start) :done) (comment (reset-db!) (refresh))