Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
81d346fc
Commit
81d346fc
authored
9 years ago
by
Allen Gilliland
Browse files
Options
Downloads
Patches
Plain Diff
make `:db-details` an optional argument to `(setup-db)`
parent
24b99a75
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/metabase/core.clj
+1
-1
1 addition, 1 deletion
src/metabase/core.clj
src/metabase/db.clj
+4
-3
4 additions, 3 deletions
src/metabase/db.clj
test/metabase/bootstrap.clj
+1
-1
1 addition, 1 deletion
test/metabase/bootstrap.clj
test/metabase/test_setup.clj
+1
-1
1 addition, 1 deletion
test/metabase/test_setup.clj
with
7 additions
and
6 deletions
src/metabase/core.clj
+
1
−
1
View file @
81d346fc
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
src/metabase/db.clj
+
4
−
3
View file @
81d346fc
...
...
@@ -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 ----------------------------------------
...
...
This diff is collapsed.
Click to expand it.
test/metabase/bootstrap.clj
+
1
−
1
View file @
81d346fc
...
...
@@ -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
))))
...
...
This diff is collapsed.
Click to expand it.
test/metabase/test_setup.clj
+
1
−
1
View file @
81d346fc
...
...
@@ -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!
))))]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment