Repository navigation
fix(upsert): sets isNewRecord to false when upserting - #12447
Conversation
5e32cfc to
a18eaf7
Compare
|
No travis build on this PR, can you try pushing an empty commit? |
|
done! check Travis, it fails on MARIADB and I don't know how to fix that without making it fail everywhere else. |
3d28419 to
9744a3d
Compare
|
managed to fix all related errors! now it fails on mysql something totally unrelated. Am I in the right path? I needed to set |
Codecov Report
@@ Coverage Diff @@
## master #12447 +/- ##
=======================================
Coverage 96.38% 96.38%
=======================================
Files 95 95
Lines 9255 9257 +2
Branches 61 54 -7
=======================================
+ Hits 8920 8922 +2
Misses 322 322
Partials 13 13
Continue to review full report at Codecov.
|
| options | ||
| ); | ||
|
|
||
| instance.isNewRecord = false; |
There was a problem hiding this comment.
Although here instance === result, we should change naming here. May be rename result to record and then set record.isNewRecord = false
There was a problem hiding this comment.
Result is actually [instance, boolean]. Should I do this?
| instance.isNewRecord = false; | |
| const [record] = result; | |
| record.isNewRecord = false; |
There was a problem hiding this comment.
Looks like tests are failing with this commit
Co-authored-by: Ariel Barabas <[email protected]>
|
I encountered same problem. waiting to get this PR to be merged. |
|
Please open a PR for |
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
I'm having problems on upsert returned instances. Doing a
.save()on an instance right after an upsert returns validation error because it tries to insert instead of updating. I think I tracked this error to havingisNewRecordastrueon that returned instance. I tried fixing it by setting it to false onupsertmethod but failed on other tests.