Skip to content

Refactoring method addFieldIfNotExists #4461

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

Merged
merged 4 commits into from
Dec 27, 2017
Merged

Refactoring method addFieldIfNotExists #4461

merged 4 commits into from
Dec 27, 2017

Conversation

vitaly-t
Copy link
Contributor

  • Using ES6 Generators syntax
  • Passing in the context into method createClass, to reuse the connection
  • Extending method createClass to reuse connections

* Using ES6 Generators syntax
* Passing in the context into method `createClass`, to reuse the connection
* Extending method `createClass` to reuse connections
forgot: extending method `createClass` to reuse the connection.
@codecov
Copy link

codecov bot commented Dec 26, 2017

Codecov Report

Merging #4461 into master will increase coverage by <.01%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4461      +/-   ##
==========================================
+ Coverage   92.68%   92.68%   +<.01%     
==========================================
  Files         118      118              
  Lines        8351     8352       +1     
==========================================
+ Hits         7740     7741       +1     
  Misses        611      611
Impacted Files Coverage Δ
...dapters/Storage/Postgres/PostgresStorageAdapter.js 97.04% <93.33%> (+0.2%) ⬆️
src/RestWrite.js 93.28% <0%> (-0.37%) ⬇️

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 820ae2b...ed2a1b2. Read the comment docs.

@vitaly-t
Copy link
Contributor Author

The code coverage thing looks like another test/coverage glitch.

@vitaly-t
Copy link
Contributor Author

@flovilmart another one, please 😉

})
if (error.code === PostgresDuplicateColumnError) {
// Column already exists, created by other request. Carry on to
// See if it's the right type.
Copy link
Contributor

Choose a reason for hiding this comment

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

We should return here and not propagate the error to match original implementation. Otherwise, remove altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But I did match the original implementation. Was it somehow wrong?

Copy link
Contributor

Choose a reason for hiding this comment

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

In the original implementation, the throw is in an else statement, so never executed if it enters the DuplicateColumnError check

fixing the re-throw logic.
@vitaly-t
Copy link
Contributor Author

@flovilmart I have applied the change for the re-throw logic. Weird, that review has disappeared here, must be a reviewing bug. Anyhow, good catch, and it is unfortunate that the existing tests do not cover that.

Copy link
Contributor

@flovilmart flovilmart left a comment

Choose a reason for hiding this comment

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

LGTM!

@vitaly-t vitaly-t merged commit 5681b3f into master Dec 27, 2017
@vitaly-t vitaly-t deleted the vitaly-t-patch-2 branch December 27, 2017 18:14
flovilmart pushed a commit that referenced this pull request Dec 29, 2017
* Refactoring method `addFieldIfNotExists`

* Using ES6 Generators syntax
* Passing in the context into method `createClass`, to reuse the connection
* Extending method `createClass` to reuse connections

* Update PostgresStorageAdapter.js

forgot: extending method `createClass` to reuse the connection.

* Update PostgresStorageAdapter.js

fixing the re-throw logic.
UnderratedDev pushed a commit to UnderratedDev/parse-server that referenced this pull request Mar 21, 2020
* Refactoring method `addFieldIfNotExists`

* Using ES6 Generators syntax
* Passing in the context into method `createClass`, to reuse the connection
* Extending method `createClass` to reuse connections

* Update PostgresStorageAdapter.js

forgot: extending method `createClass` to reuse the connection.

* Update PostgresStorageAdapter.js

fixing the re-throw logic.
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.

2 participants