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

feat(core): Flexible connection resolution strategy when using read-replicas #2896

Merged
merged 5 commits into from Mar 11, 2022

Conversation

asiFarran
Copy link
Contributor

@asiFarran asiFarran commented Mar 11, 2022

Allows developers working with read-replicas the flexibility to:

  • Set the default resolution strategy for read operations (resolve to a read-replica or write connection)
  • Be explicit on a per-query basis by extending FindOptions and CountOptions with a connectionType property

@B4nan
Copy link
Member

B4nan commented Mar 11, 2022

please remove all unrelated code style changes, and the yarn log file

@B4nan
Copy link
Member

B4nan commented Mar 11, 2022

Note that we need to keep supporting the string constants (otherwise this would be a breaking change on type level), so remove all of those changes too.

@asiFarran asiFarran force-pushed the connection-resolution-strategy branch from f01eb0e to a179406 Compare March 11, 2022 16:54
@asiFarran
Copy link
Contributor Author

asiFarran commented Mar 11, 2022

Note that we need to keep supporting the string constants (otherwise this would be a breaking change on type level), so remove all of those changes too.

I restored the string constants but did wrap them to a union-type so as to make signatures shorter & 'safer'

Copy link
Member

@B4nan B4nan left a comment

Choose a reason for hiding this comment

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

looking good, just two nits

packages/knex/src/AbstractSqlDriver.ts Outdated Show resolved Hide resolved
tests/EntityManager.mysql.test.ts Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Mar 11, 2022

Codecov Report

Merging #2896 (601d9b8) into master (a4bbebc) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2896   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          194       194           
  Lines        11738     11756   +18     
  Branches      2701      2703    +2     
=========================================
+ Hits         11738     11756   +18     
Impacted Files Coverage Δ
packages/core/src/drivers/IDatabaseDriver.ts 100.00% <ø> (ø)
packages/core/src/typings.ts 100.00% <ø> (ø)
packages/core/src/utils/Configuration.ts 100.00% <ø> (ø)
packages/core/src/EntityManager.ts 100.00% <100.00%> (ø)
packages/core/src/connections/Connection.ts 100.00% <100.00%> (ø)
packages/core/src/drivers/DatabaseDriver.ts 100.00% <100.00%> (ø)
packages/knex/src/AbstractSqlDriver.ts 100.00% <100.00%> (ø)
packages/knex/src/SqlEntityManager.ts 100.00% <100.00%> (ø)
packages/knex/src/SqlEntityRepository.ts 100.00% <100.00%> (ø)
packages/knex/src/query/QueryBuilder.ts 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a4bbebc...601d9b8. Read the comment docs.

@B4nan B4nan merged commit e40ae2d into mikro-orm:master Mar 11, 2022
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.

None yet

3 participants