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: add setOnLocked for SKIP LOCKED and NOWAIT #9317
Conversation
54891b0
to
1eca0c4
Compare
Someone left "only" in the tests. Merge the latest master into your branch and you will have all tests working. |
Looks good to me, we also need to update the documentation to document all the new options. |
Thanks @pleerock. I will add the tests and the docs. Do you specify which version of MySql TypeORM supports? Version 8 of MySQL has |
If you are talking about documentation, you can simply treat like everyone is using version 8, but if you want to provide additional information regarding to version 5, just put small remarks / comments. |
Is there a way to get the version of the DB in code? The code for mysql currently uses If this change needs to be backwards compatible, I cannot support MySQL on |
We have a code that does version check in |
1eca0c4
to
0492524
Compare
@pleerock Should be good to review now. I added some comments about deprecating |
5ab4108
to
d1ec672
Compare
Can you please merge the latest master into your branch? Tests are failing because of it... |
d1ec672
to
5a9ae8f
Compare
@pleerock Updated to latest master |
9e7ecf7
to
af6426e
Compare
This is my first time working on this codebase. I think it probably makes sense to refactor some of the query builders to have a different file per driver (not this PR obviously). The |
af6426e
to
769257c
Compare
769257c
to
8c54883
Compare
I know. This codebase is like 8 years old and most of its parts need refactoring. Unfortunately I don't have much time to do it (plus you always afraid to break something, too many people depend on it). And unfortunately when last time I let other people to completely refactor some of the code, now I cannot understand the details of their re-write in order to merge changes / fix issues related to their code. And these people are not available anymore (or don't respond). So better to keep things this way for now. Unfortunate, but for the good. |
I'll merge it. Thanks for the contribution! |
@pleerock Really appreciate the quick review and merge! I understand open source is a ton of work (I have a few libraries of my own). How often do you do releases? |
Usually once in month-two. Next release will be this week. |
Description of change
Fixes #8911
This adds a function
addOnLocked
to the select query builder. Instead of adding multiple new values to thelockMode
enum to supportFOR SHARE
,FOR KEY SHARE
andFOR NO KEY UPDATE
, this changes the pattern to add aonLocked
to the expression map. Valid values foronLocked
arenowait
orskip_locked
.As part of this change we should deprecate
"pessimistic_partial_write"
andpessimistic_write_or_fail
because they are no longer necessary with this change and remove them on the next major version change.Added tests and updated the docs with the new option
setOnLocked
Pull-Request Checklist
master
branchnpm run format
to apply prettier formattingnpm run test
passes with this changeFixes #0000