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
I have a model Contratto (contract). Every contract has one or more guests and the relation ContrattoSuOspite (contract-on-guests) is a relation made exactly to connect the guests to a contract. There is the delete cascade, so there should be no problem in deleting the contract. Instead, I have an error.
It should delete both the contratto and its contratto-su-ospite (contract-on-guest) tuples.
Prisma information
I get this error instead:
[ERROR] Server error PrismaClientKnownRequestError2 [PrismaClientKnownRequestError]:
Invalid `prisma.contratto.delete()` invocation:
The change you are trying to make would violate the required relation 'ContrattoToContrattoSuOspite' between the `Contratto` and `ContrattoSuOspite` models.
at cb (/home/euber/Github/150/operatn-backend/node_modules/@prisma/client/runtime/index.js:79160:17)
at processTicksAndRejections (node:internal/process/task_queues:94:5) {
code: 'P2014',
clientVersion: '2.18.0',
meta: {
relation_name: 'ContrattoToContrattoSuOspite',
model_a_name: 'Contratto',
model_b_name: 'ContrattoSuOspite'
}
}
I also do not want to set the relation optional, because it is not and it is not necessary because of the delete cascade.
Environment & setup
OS: Ubuntu 20
Database: Postgres
Node.js version: 15.11.0
Prisma version: 2.18
The text was updated successfully, but these errors were encountered:
Bug description
I have a model
Contratto
(contract). Every contract has one or more guests and the relationContrattoSuOspite
(contract-on-guests) is a relation made exactly to connect the guests to a contract. There is the delete cascade, so there should be no problem in deleting the contract. Instead, I have an error.How to reproduce
The (simplified) schema is:
Then I try to delete a contratto:
Expected behavior
It should delete both the contratto and its contratto-su-ospite (contract-on-guest) tuples.
Prisma information
I get this error instead:
I also do not want to set the relation optional, because it is not and it is not necessary because of the delete cascade.
Environment & setup
The text was updated successfully, but these errors were encountered: