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
2d5f2c76
Commit
2d5f2c76
authored
9 years ago
by
Cam Saul
Browse files
Options
Downloads
Patches
Plain Diff
test fix
parent
85a56123
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/driver/postgres.clj
+7
-6
7 additions, 6 deletions
src/metabase/driver/postgres.clj
test/metabase/db/migrate_details_test.clj
+4
-3
4 additions, 3 deletions
test/metabase/db/migrate_details_test.clj
with
11 additions
and
9 deletions
src/metabase/driver/postgres.clj
+
7
−
6
View file @
2d5f2c76
...
...
@@ -100,12 +100,13 @@
"Parse a legacy `database.details.conn_str` CONNECTION-STRING and return a new-style map."
[
connection-string
]
{
:pre
[(
string?
connection-string
)]}
(
-<>>
connection-string
(
s/split
<>
#
" "
)
; split into k=v pairs
(
map
(
fn
[
pair
]
; convert to {:k v} pairs
(
let
[[
k
v
]
(
s/split
pair
#
"="
)]
{(
keyword
k
)
v
})))
(
reduce
conj
{})))
(
let
[
details
(
-<>>
connection-string
(
s/split
<>
#
" "
)
; split into k=v pairs
(
map
(
fn
[
pair
]
; convert to {:k v} pairs
(
let
[[
k
v
]
(
s/split
pair
#
"="
)]
{(
keyword
k
)
v
})))
(
reduce
conj
{}))]
(
assoc
details
:port
(
Integer/parseInt
(
:port
details
)))))
(
defn-
database->connection-details
[{
:keys
[
details
]}]
(
let
[{
:keys
[
host
port
]
:as
details
}
(
if
(
is-legacy-conn-details?
details
)
(
parse-legacy-conn-str
(
:conn_str
details
))
...
...
This diff is collapsed.
Click to expand it.
test/metabase/db/migrate_details_test.clj
+
4
−
3
View file @
2d5f2c76
...
...
@@ -7,9 +7,10 @@
;; ## legacy postgres
(
expect
{
:user
"cam"
:dbname
"fakedb"
:port
"
5432
"
:port
5432
:host
"localhost"
:timezone
"US/Pacific"
}
:timezone
"US/Pacific"
:conn_str
"host=localhost port=5432 dbname=fakedb user=cam"
}
(
convert-details-when-legacy
:postgres
{
:conn_str
"host=localhost port=5432 dbname=fakedb user=cam"
...
...
@@ -21,7 +22,7 @@
:postgres
{
:ssl
false
:host
"localhost"
:port
"
5432
"
:port
5432
:dbname
"ryde"
:user
"cam"
:conn_str
"host=localhost port=5432 dbname=ryde user=cam"
}))
...
...
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