Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move database connection utils to dbconn #17399

Merged
merged 7 commits into from Jan 20, 2021
Merged

Conversation

asdine
Copy link
Contributor

@asdine asdine commented Jan 19, 2021

There currently are two separate connection helpers, using two different PG drivers.
This unifies database connection helpers and merges them into one single package.
dbconn is now the only package responsible for connecting to the database and database migrations.
dbutil is now only responsible for generic helpers.

Note: This relies on adding support for driver.ConnBeginTx on the sqlhooks package qustavo/sqlhooks#33

Fixes #16586

@asdine asdine added this to the Cloud 2021-01-13 milestone Jan 19, 2021
@sourcegraph-bot
Copy link
Contributor

sourcegraph-bot commented Jan 19, 2021

Notifying subscribers in CODENOTIFY files for diff f96e136...46ae581.

Notify File(s)
@efritz internal/db/basestore/handle.go
internal/db/dbconn/dbconn.go
internal/db/dbconn/migration.go
internal/db/dbtest/dbtest.go
internal/db/dbtesting/dbtesting.go
internal/db/dbutil/dbutil.go
@keegancsmith cmd/gitserver/main.go

@asdine asdine requested a review from a team January 19, 2021 07:29
Copy link
Contributor

@ryanslade ryanslade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Did you check a migration just to be sure that nothing broke there?

@asdine
Copy link
Contributor Author

asdine commented Jan 19, 2021

@ryanslade Not yet, once sqlhooks gets updated I will run integration tests and a migration to check if every is fine

Copy link
Contributor

@tsenart tsenart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can merge this if we use your fork as a dependency and update later once it's merged upstream.

@codecov
Copy link

codecov bot commented Jan 20, 2021

Codecov Report

Merging #17399 (46ae581) into main (f96e136) will increase coverage by 0.01%.
The diff coverage is 14.54%.

@@            Coverage Diff             @@
##             main   #17399      +/-   ##
==========================================
+ Coverage   51.87%   51.89%   +0.01%     
==========================================
  Files        1716     1717       +1     
  Lines       85296    85275      -21     
  Branches     7647     7634      -13     
==========================================
+ Hits        44246    44251       +5     
+ Misses      37148    37124      -24     
+ Partials     3902     3900       -2     
Flag Coverage Δ
go 50.87% <14.54%> (+0.02%) ⬆️
integration 30.69% <ø> (+<0.01%) ⬆️
storybook 30.34% <ø> (ø)
typescript 54.35% <ø> (+<0.01%) ⬆️
unit 34.72% <ø> (ø)
Impacted Files Coverage Δ
cmd/gitserver/main.go 10.12% <0.00%> (ø)
internal/db/basestore/handle.go 61.53% <0.00%> (ø)
internal/db/dbconn/dbconn.go 11.38% <0.00%> (ø)
internal/db/dbutil/dbutil.go 19.14% <ø> (+2.32%) ⬆️
internal/db/dbconn/migration.go 17.39% <17.39%> (ø)
client/web/src/nav/StatusMessagesNavItem.tsx 87.71% <0.00%> (+1.75%) ⬆️
.../internal/codeintel/resolvers/graphql/locations.go 85.56% <0.00%> (+4.12%) ⬆️

@asdine asdine merged commit af2c3a2 into main Jan 20, 2021
@asdine asdine deleted the asdine/merge-dbutil-dbconn branch January 20, 2021 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Merge dbconn and dbutil packages
5 participants