-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
The type of where
part of delete
or update
function is wrong when using @@unique
#11284
Comments
Hello! The correct query should be: await this.prisma.channel.delete({ where: { userId_name: { userId: 1, name: 'John' } }); You can use editor suggestions (CTRL+space for vscode) to see available options. If you need to delete rows by channel id and userId then you should create a unique index await this.prisma.channel.delete({ where: { userId_id: { userId: 1, id: 1 } }); You can also delete all rows await this.prisma.channel.deleteMany({ where: { id: 1, userId:1 } }); |
I want to delete just one single row and only if it's belongs to a specific user. But I don't know the name this.prisma.channel.update({ where: { id: request.id, userId }, data:{name:'new Name'} });
this.prisma.channel.u({ where: { id: request.id, userId } }); |
where
part of delete
function is wrong when using @@unique
where
part of delete
or update
function is wrong when using @@unique
This is duplicate of #7290 |
Bug description
I have a model containing
@@unique
index. When I want to addwhere
section todelete
function it's type is wrong.How 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:
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: