Skip to content
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${type} asks for ${type}UpdateManyMutationInput instead of ${type}UpdateInput #346

Open
yukulelix opened this issue Mar 5, 2019 · 5 comments

Comments

@yukulelix
Copy link

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 !

@pantharshit00
Copy link
Contributor

pantharshit00 commented Mar 6, 2019

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.

@schickling schickling transferred this issue from prisma/prisma1 Mar 6, 2019
@yukulelix
Copy link
Author

yukulelix commented Mar 11, 2019

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 !

@yukulelix
Copy link
Author

Any news on this @pantharshit00 ?

@nugoo1
Copy link

nugoo1 commented Jun 17, 2019

Hi I'm getting a very similar error!
Basically the production scheme is completely different to my development schema.. What's happening here?

@the-simian
Copy link

I'm experiencing this as well, I'm passing data as the docs say to do, I don't see anything about UpdateManyMutationInput

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants