1 | initial version |
To switch the unique constraint on the index when updating two items in Prisma:
await prisma.myModel.update({
where: { id: firstItemId },
data: { name: null },
})
await prisma.myModel.update({
where: { id: secondItemId },
data: { name: "newName" },
})
await prisma.myModel.update({
where: { id: firstItemId },
data: { name: "newFirstItemName" },
})
By doing this, you are effectively switching the unique constraints of the two items.