Something else is going on. I load and re-load this improved version of the file and it works as expected:
user=> (load-file "/Users/pupeno/Projects/mgr/src/lobos/config.clj")
{:connection #<Jdbc4Connection org.postgresql.jdbc4.Jdbc4Connection@94f1726>, :db-spec {:classname "org.postgresql.Driver", :subprotocol "postgresql", :subname "//localhost:5432/mgr"}}
user=> (load-file "/Users/pupeno/Projects/mgr/src/lobos/config.clj")
{:connection #<Jdbc4Connection org.postgresql.jdbc4.Jdbc4Connection@94f1726>, :db-spec {:classname "org.postgresql.Driver", :subprotocol "postgresql", :subname "//localhost:5432/mgr"}}
user=> (load-file "/Users/pupeno/Projects/mgr/src/lobos/config.clj")
{:connection #<Jdbc4Connection org.postgresql.jdbc4.Jdbc4Connection@94f1726>, :db-spec {:classname "org.postgresql.Driver", :subprotocol "postgresql", :subname "//localhost:5432/mgr"}}
but when I load migrations.clj, I get the error:
user=> (load-file "/Users/pupeno/Projects/mgr/src/lobos/migrations.clj")
java.lang.Exception: A global connection by that name already exists (:default-connection) (config.clj:1)
The contents of migrations.clj is this:
(ns lobos.migrations
(:refer-clojure :exclude [alter defonce drop bigint boolean char double float time])
(:use (lobos [migration :only [defmigration]] core schema)
lobos.config)
(:require lobos.connectivity
lobos.core
[clojureql.core :as clq]))
;(println @(clq/table db :foo))
(defmigration create-admins
(up [] (println "up"))
(down [] (println "down")))
(lobos.core/run)
Any ideas what might be going on here? Something else creating the default connection?
PS: why don't I get stack traces? this is driving me crazy