Describe the bug
I have a model containing @@unique index. When I want to add where section to delete function it's type is wrong.
To Reproduce
Generate this model:
model User {
id Int @id @default(autoincrement())
email String @unique
password String
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
remarks String?
Channels Channel[]
}
model Channel {
id Int @id @default(autoincrement())
name String
userId Int
user User @relation(fields: [userId], references: [id])
@@unique([userId, name])
@@index([name])
}
It generates this class:
export type ChannelDeleteArgs = {
select?: ChannelSelect | null
include?: ChannelInclude | null
where: ChannelWhereUniqueInput
}
export type ChannelWhereUniqueInput = {
id?: number
userId_name?: ChannelUserIdNameCompoundUniqueInput
}
The where part is different from find and create commands and does not have channel fields. Now I see this error:
'userId' does not exist in type 'ChannelWhereUniqueInput'
Expected behavior
I want to delete a channel with this comand:
Describe the bug I have a model containing
@@unique
index. When I want to addwhere
section todelete
function it's type is wrong.To Reproduce Generate this model:
It generates this class:
The
where
part is different fromfind
andcreate
commands and does not havechannel
fields. Now I see this error:Expected behavior I want to delete a channel with this comand:
Versions (please complete the following information):
prisma
CLI: 3.8.1prisma-client