metabase / toucan

A classy high-level Clojure library for defining application models and retrieving them from a DB
Eclipse Public License 1.0
570 stars 49 forks source link

Add ability to designate a function for DB setup & automatically run it #7

Open camsaul opened 7 years ago

camsaul commented 7 years ago

Slightly inconvenient that we have to call appropriate DB setup functions when using from the REPL, e.g. in Metabase:

(metabase.db/setup-db-if-needed!)

It would be more convenient if we could tag a certain function as the DB setup function:

(defn ^:toucan/setup-fn setup-db-if-needed! []
 ...)

and have Toucan automatically find and run this function using the namespace tools if the DB is not yet set up.