I clicked `DELETE NODE` inside Prisma Admin a coup...
# orm-help
i
I clicked
DELETE NODE
inside Prisma Admin a couple times and my server got this:
d
cc @huv1k
i
I guess it’s probably because I set both relations to
CASCADE
h
Can you share your data-model and what you deleted?
d
Can you reliably reproduce this error? Along with the datamodel can you please share how you are hosting Prisma server and the server version?
i
Copy code
type BloodPressure {
  id: ID! @unique
  mainId: Int! @unique
  user: User @relation(name: "BloodPressureToUser")
  pulse: Int!
  pulseUnits: String!
  diastolic: Int!
  systolic: Int!
  bloodPressureUnits: String!
  measuredAt: DateTime!
  measuredAtLocal: DateTime!
  userMessage: UserMessage @relation(name: "BloodPressureToUserMessage", onDelete: CASCADE)
}

type UserMessage {
  id: ID! @unique
  user: User! @relation(name: "UserToUserMessage", onDelete: CASCADE)
  message: Message
  bloodPressure: BloodPressure @relation(name: "BloodPressureToUserMessage", onDelete: CASCADE)
  isResponded: Boolean! @default(value: "false")
  response: UserMessageResponse @relation(name: "UserMessageToUserMessageResponse", onDelete: CASCADE)
  createdAt: DateTime!
}
h
I think you can’t have cascade on both sides of relation, but its just my guess 🙂
i
@divyendu It’s hosted with Docker, latest Prisma version. When I’m trying to delete
BloodPressure
it gives GC overhead
@huv1k That’s what I’ve figured too
h
And if you remove that do you get same result?
i
Now I can’t reset my Prisma🤣
I think it’s fine
Not sure was it due to both sides CASCADE or smth else
h
I will ask somebody about that 🙂 thx for reporting this
I’ll check again
h
Okey so maybe its problem again 🙂
i
Probably I did something wrong with my models
I’ll reply as soon as I figure it out
Yep, works fine, fixed it🦜
h
Hi @impowski Can you tell me a bit more about the "fix" you made?
i
@Harshit The problem was basically in wrong relationships between models, I’ve checked all models one by one if they were deleting in the right way and then I’ve added relationships with which I had a problem. Everything worked like I expected it to work, but when I tried to
deleteMany
it didn’t due to Prisma lacking that feature. I fixed
deleteMany
with just adding a boolean flag for
UserMessage
so if it related to
BloodPressure
it will be deleted.