Unique constraint error when connecting an item in a 1-1 relation that is already connected #16743
Labels
bug/2-confirmed
Bug has been reproduced and confirmed.
kind/regression
A reported bug in functionality that used to work before.
team/client
Issue for team Client.
topic: constraint
Milestone
Bug description
When connecting an item that is already connected in a 1-1 relation, the item is not disconnected from the previous item when connecting to a new item so a unique constraint error occurs. In versions prior to 4.7.0, the item was disconnected as expected.
How to reproduce
schema.prisma
with the schema below.prisma db push
index.js
with the code below.node index.js
Expected behavior
The first item is disconnected before connecting to the new item like on versions prior to 4.7.0.
The output of the same code on Prisma 4.6.1:
Prisma information
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: