studio icon indicating copy to clipboard operation
studio copied to clipboard

Cannot create row with null in Json? field

Open squirly opened this issue 3 years ago • 0 comments

  1. Prisma version (prisma -v or npx prisma -v): 3.11.0

  2. Logs from Developer Tools Console or Command line, if any:

Type: undefined
Message: 
Invalid `prisma.partner.create()` invocation:

{
  data: {
    name: 'test',
    branding: null,
  },
  select: {
    id: true,
    createdAt: true,
    updatedAt: true,
    name: true,
    branding: true,
}

Argument branding for data.branding must not be null. Please use undefined instead.

Code: undefined

Query:
[object Object]
  1. Does the issue persist even after updating to the latest prisma CLI dev version? (npm i -D prisma@dev) Yes!

  2. Prisma schema (if relevant):

model Partner {
  id        String   @id @default(dbgenerated("cuid()"))
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @default(now()) @updatedAt @map("updated_at")

  name     String @map("name")
  branding Json?  @map("branding")

  @@map("partner")
}

Related: https://github.com/prisma/studio/issues/854

squirly avatar Mar 18 '22 18:03 squirly