prisma-binding
prisma-binding copied to clipboard
UpdateMany${type} asks for ${type}UpdateManyMutationInput instead of ${type}UpdateInput
The bug Hi there, I'm having some issues using an updateMany mutation with prisma binding :
prisma.mutation.updateManyReviews(
{
where: { key_in: keys },
data: { analysisStatus: 'PENDING' }
},
'{ count }'
)
When the function runs, it's giving me this error :
Variable '$_v0_data' of type 'ReviewUpdateInput!' used in position expecting type 'ReviewUpdateManyMutationInput!'. (line 1, column 11):
mutation ($_v0_data: ReviewUpdateInput!, $_v1_where: ReviewWhereInput) {
^
(line 2, column 27):
updateManyReviews(data: $_v0_data, where: $_v1_where) {
^
But in the generated model, I have no trace of a ReviewUpdateManyMutationInput :
updateManyReviews(data: ReviewUpdateInput!, where: ReviewWhereInput): BatchPayload!
Versions (please complete the following information):
- Connector: MySQL
- Prisma Server: 1.27.4
- other dependencies: prisma-binding
Thanks for your help !
Hi @yukulelix
Can you please also share your datamodel so that I can try to reproduce this?
Also, we may transfer this to prisma bindings repository itself as it seems to be solely related to it.
Hi @pantharshit00, thanks for your help :) The related datamodel part is :
enum ReviewAnalysisStatusType {
INITIAL
PENDING
DONE
}
type Review {
id: ID! @unique
key: String! @unique
createdAt: DateTime!
updatedAt: DateTime!
publishedAt: String
analysisStatus: ReviewAnalysisStatusType! @default(value: INITIAL)
}
The javascript function that produces the error is :
import { Prisma } from 'prisma-binding'
import typeDefs from '../../database/generated/prisma.graphql'
async function updateManyReviewsAnalysisStatus (keys, analysisStatus) {
const db = new Prisma({
typeDefs,
endpoint: "endpoint",
secret: "***"
})
return db.mutation.updateManyReviews(
{
where: { key_in: keys },
data: { analysisStatus }
},
'{ count }'
)
}
// Called like this
updateManyReviewsAnalysisStatus(["key-one", "key-two"], "PENDING")
Thanks in advance !
Any news on this @pantharshit00 ?
Hi I'm getting a very similar error! Basically the production scheme is completely different to my development schema.. What's happening here?
I'm experiencing this as well, I'm passing data as the docs say to do, I don't see anything about UpdateManyMutationInput