Skip to content

@@unique with multiple fields cause error when findUnique() #196

Closed
@ymc9

Description

@ymc9

Describe the bug

model Model {
        id String @id @default(uuid())
        a String
        b String
        @@unique([a, b])
        @@allow('all', true)
}
await withPresets(prisma).model.findUnique({ where: { a_b: { a: 'a', b: 'b' } } }));

Error

Invalid prisma.model.findMany() invocation:

{
  where: {
    AND: [
      {
        a_b: {
        ~~~
          a: 'a1',
          b: 'b1'
        }
      },
      {
        x: {
          gt: 0
        }
      }
    ]
  }
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions