new guy with wierd error when deleting a record trough prisma studio
i got this message when deleting a record. same thing happens with prisma postgres.
4 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
Based on your description, it sounds like you're encountering an error when trying to delete a record through Prisma Studio. This is a common issue that can happen for several reasons.
Without seeing the specific error message, I can suggest a few common scenarios that might be causing this:
1. Foreign Key Constraints: The most common reason for deletion errors is that the record you're trying to delete is referenced by other records through foreign key relationships.
If you're using referential integrity, Prisma will prevent you from deleting a record that has dependent records in other tables. As mentioned in this GitHub issue, Prisma enforces these constraints to maintain data integrity.
2. Record Not Found: If you're trying to delete a record that doesn't exist, Prisma will throw an error like "Record to delete does not exist" as described in this discussion.
3. PlanetScale-specific Issues: If you're using PlanetScale, there are some known issues with deletions, such as the "symbol not found" error mentioned in this GitHub issue.
To better help you, I'd need to see the specific error message you're getting. However, here are some potential solutions:
- Use
deleteMany
instead of delete
if you're not sure if the record exists
- Set up proper cascading deletes in your schema using onDelete: Cascade
for relations
- Check if there are any dependent records that need to be deleted first
If you can share the specific error message and your schema, I could provide more targeted assistance.
ā
Great, thanks for letting us know that this solved your question!Hey š
Is the error resolved now?
What was causing this issue?
well, yes and no. when i try the delete on my local dev machine, it works now. the problem was FK's that were incorrect. But I host my DB on Prisma and my app on netlify. but now when i try to delete a record i get no error but the delete fails. how can i rty an sql query to see what fails?
well, yes and no. when i try the delete on my local dev machine, it works now. the problem was FK's that were incorrect. But I host my DB on Prisma and my app on netlify. but now when i try to delete a record i get no error but the delete fails. how can i rty an sql query to see what fails?
Hmm, strange! So the record doesn't get deleted but there are no errors as well.
Do you mind sharing your model in which you face this issue? I would like to reproduce this