Using clojure and clojure-sql with postgresql.
I am trying to make a bootstrap function, so I want to drop all the tables in the db and then rebuild them cleanly. As there are an arbitrary number of tables it would be nice if I could just drop them all at once. However, this fails:
(def db
{:classname "org.postgresql.Driver"
:subprotocol "postgresql"
:subname "//localhost/triface"
:user "postgres"})
(defn rebuild-table []
(sql/with-connection db
(sql/do-commands "drop database triface" "create database triface")))
How do I issue a drop database command from a somehow modified connection?
Figured this one out from another question over here: How do I drop or create a database from clojure.java.jdbc? .
Finally!