You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Prisma Extension for soft delete is deleting related records even when the schema explicitly sets onDelete: Restrict. According to Prisma's behavior, the onDelete: Restrict rule should prevent a User from being deleted if they have related Post records. However, using this extension, the user is still soft deleted, even though they have related posts.
Bug: Soft Delete Bypasses
onDelete: Restrict
ConstraintDescription
The Prisma Extension for soft delete is deleting related records even when the schema explicitly sets
onDelete: Restrict
. According to Prisma's behavior, theonDelete: Restrict
rule should prevent a User from being deleted if they have related Post records. However, using this extension, the user is still soft deleted, even though they have related posts.Steps to Reproduce
Define the following Prisma schema:
Create a user and a related post:
Attempt to soft delete the user:
Expected Behavior
The delete operation should be blocked due to the
onDelete: Restrict
rule.Actual Behavior
The user is deleted successfully, even though they have a related Post record. This violates the expected behavior of
onDelete: Restrict
.Possible Fix
Ensure that the extension respects
onDelete: Restrict
and prevents deletion when related records exist.Additional Context
If the extension is overriding Prisma's default behavior, it should at least provide an option to enforce
onDelete: Restrict
.The text was updated successfully, but these errors were encountered: