Skip to content
This repository has been archived by the owner on Jan 14, 2021. It is now read-only.

updateMany should return count of updated records #82

Closed
nikolasburk opened this issue Jun 10, 2019 · 3 comments
Closed

updateMany should return count of updated records #82

nikolasburk opened this issue Jun 10, 2019 · 3 comments
Assignees
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug.
Milestone

Comments

@nikolasburk
Copy link
Member

I have this User model:

model User {
  id: Int @id
  name: String
}

The updateMany method for this model has the following signature:

 updateMany<T extends UserUpdateManyArgs>(args: Subset<T, UserUpdateManyArgs>): 'select' extends keyof T ? PromiseLike<UserGetPayload<ExtractUserUpdateManyArgsSelect<T>>> : UserClient<User>;

This means I'm just getting a single User object back. It should return the number records that have been updated in the database.

The same problem seems to exist for deleteMany.

image

@matthewmueller matthewmueller transferred this issue from another repository Jun 27, 2019
@n1ru4l
Copy link

n1ru4l commented Jun 27, 2019

Postgres supports the RETURNING statement, wouldn't that be performant enough? Or will it not be included because MySQL has no equivalent?

Disclaimer: I have no idea about the implementation details, just started looking at the examples and the blog post and wanted to check some of the issue when I saw this 😄 I am pretty hyped to test this stuff in a new project 👍

@schickling schickling added priority/high bug/0-needs-info More information is needed for reproduction. and removed priority/high labels Jun 28, 2019
@timsuchanek timsuchanek added the kind/bug A reported bug. label Jul 2, 2019
@timsuchanek timsuchanek assigned timsuchanek and unassigned dpetrick Aug 5, 2019
@timsuchanek timsuchanek added release/preview6 bug/2-confirmed We have confirmed that this is a bug. and removed bug/0-needs-info More information is needed for reproduction. labels Aug 5, 2019
@janpio janpio added this to the Preview 6 milestone Aug 9, 2019
@tvvignesh
Copy link

@nikolasburk Hi there. I understand this is a closed issue. But, what if we cant to get the value of the updated records? Shouldn't there be a select or include to do that?

While I understand cound is done for performance reasons, but can't we have the updated records returned only when user explicitly asks for it?

Thanks.

@pantharshit00
Copy link
Contributor

I guess you already opened an issue for this. Please follow https://github.com/prisma/photonjs/issues/394 for this now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/2-confirmed We have confirmed that this is a bug. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

8 participants