With Prisma is it possible to completely overwrite a relation rather than connecting and disconnecting individual nodes?
Say I have a user with a groups relation to groups 1 and 2:
user: {
id: "abcd"
groups: [
{id: 1},
{id: 2}
]
}
If I want to make this user only connected to group 3:
user: {
id: "abcd"
groups: [
{id: 3}
]
}
Do I have to do this?:
mutation {
updateUser(
where: { id: "abcd" }
data: {
groups: {
disconnect: {
id: "1"
id: "2"
}
connect: {
id: "3"
}
}
}
) {
id
}
}
Or is there some way of overwriting the entire relation:
mutation {
updateUser(
where: { id: "abcd" }
data: {
groups: [{id:3}]
}
) {
id
name
}
}