PrismaP
Prisma6mo ago
7 replies
Zeke

Can't Null a Compound-unique Value

I have something like this:
model MyModel {
  fieldOne String
  fieldTwo String
  fieldThree String?

  @@unique([fieldOne, fieldTwo, fieldThree])
}


I'm attempting to do a query like this:

prisma.MyModel.upsert({
  where: {
    fieldOne_fieldTwo_fieldThree: {
       fieldOne: 'one',
       fieldTwo: 'two',
       fieldThree: null, // this gives me a typeerror, claiming it must be a string. fieldThree is nullable, so it *should* be allowed!
    }
  }
})
Was this page helpful?