Skip to content
Snippets Groups Projects
Commit 81d346fc authored by Allen Gilliland's avatar Allen Gilliland
Browse files

make `:db-details` an optional argument to `(setup-db)`

parent 24b99a75
No related branches found
No related tags found
No related merge requests found
......@@ -121,7 +121,7 @@
(reset! metabase-initialization-progress 0.3)
;; startup database. validates connection & runs any necessary migrations
(db/setup-db @db/db-connection-details :auto-migrate (config/config-bool :mb-db-automigrate))
(db/setup-db :auto-migrate (config/config-bool :mb-db-automigrate))
(reset! metabase-initialization-progress 0.5)
;; run a very quick check to see if we are doing a first time installation
......
......@@ -148,8 +148,9 @@
(defn setup-db
"Do general perparation of database by validating that we can connect.
Caller can specify if we should run any pending database migrations."
[db-details & {:keys [auto-migrate]
:or {auto-migrate true}}]
[& {:keys [db-details auto-migrate]
:or {db-details @db-connection-details
auto-migrate true}}]
(reset! setup-db-has-been-called? true)
;; Test DB connection and throw exception if we have any troubles connecting
......@@ -183,7 +184,7 @@
(defn setup-db-if-needed [& args]
(when-not @setup-db-has-been-called?
(apply setup-db @db-connection-details args)))
(apply setup-db args)))
;; # ---------------------------------------- UTILITY FUNCTIONS ----------------------------------------
......
......@@ -15,7 +15,7 @@
"Create a `User` for development purposes.
You may optionally load the test data."
[]
(setup-db @db-connection-details :auto-migrate true)
(setup-db :auto-migrate true)
(let [{:keys [email]} (bootstrap-user)]
(println (format "Successfully created User \"%s\"." email))))
......
......@@ -80,7 +80,7 @@
[]
;; We can shave about a second from unit test launch time by doing the various setup stages in on different threads
(let [setup-db (future (time (do (log/info "Setting up test DB and running migrations...")
(db/setup-db @db/db-connection-details :auto-migrate true)
(db/setup-db :auto-migrate true)
(load-test-datasets)
(metabase.models.setting/set :site-name "Metabase Test")
(core/initialization-complete!))))]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment