I have this schema here:
model label {
title String @id @db.VarChar(16)
color String @db.VarChar(16)
labelplaylist labelplaylist[]
}
model labelplaylist {
playlistId Int
labelId String @db.VarChar(16)
label label @relation(fields: [labelId], references: [title])
playlist playlist @relation(fields: [playlistId], references: [id])
@@id([playlistId, labelId])
@@index([labelId], name: "labelId")
}
model playlist {
id Int @id @default(autoincrement())
createdAt DateTime? @default(now()) @db.DateTime(0)
title String @db.VarChar(100)
labelplaylist labelplaylist[]
@@index([userId], name: "userId")
}
And I would like to delete only the relation between the label and the playlist table. I tried it to do like this:
const deleteRelation = await prisma.labelplaylist.delete({
where: {
playlistId_labelId:
},
})
I have the primary key of the label and playlist table, but I don't know how I get the primary key => playlistId_labelId.
Thank's for helping out.