-
Notifications
You must be signed in to change notification settings - Fork 38
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
updateMany, deleteMany #311
Comments
Good idea. This should be pretty straightforward given I already have a pattern for https://github.com/goldcaddy77/warthog/blob/master/src/core/BaseService.ts#L151 If you want to take a crack at this, feel free. You should really just need to search for |
A few follow-ups... some assumptions:
Note that running the hooks will require individual saves which will be much slower, but safer. |
Good point. Although I assume that is something TypeORM already takes care of, since it already supports the functionality of updating and deleting multiple records through EntityManager. But we should test it out and make sure it works as expected (and is performant-- not making too many SQL queries for one bulk update) I'll take a look at it sometime later this week. Edit: I'm referring to your latest comment about the hooks, in case it wasn't clear |
@FOSSforlife - per TypeORM's docs:
So this essentially does an UPDATE query blindly. I could easily get this in place, but I imagine folks would want this to run the hooks. What is your use case? |
My use case is enabling users to update their album collections using bulk queries. Thinking about it now, I'm not sure if I'll be writing update or destroy hooks for this, but if I was I would definitely want them to run on updateMany and deleteMany. I wonder what's the most performant way to do this. I'm imagining that we'd have to batch together any queries that are run in the hooks, so that it's not making a separate SQL query on each update/delete. I'm not sure how hard it would be to do that. |
I'm wondering if this is the same discussion that the TypeORM folks had when they were considering adding |
I would love to see mutations that can update and delete multiple items based on a "where" clause. It would be based on the Postgres functionality that already exists, which Hasura has a nice implementation of.
The text was updated successfully, but these errors were encountered: