-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot delete data by ID if model has a relation on MySQL #1419
Comments
Just confirmed as well that deleting the relation field allows you to delete entries by ID again. |
Confirmed bug with oneWay Relations on the end model (source model is fine as it doesn't have a relation defined) |
Also confirmed oneToOne issue on both sides. |
I'm on master branch and I can't reproduce this issue. Can you give me the data creation/deletion step you did please. |
@lauriejim I'm just posting data via postman, delete in the same way Model1: Model2: Posting data to a model called Attempting to delete that data via postman: |
Deleting via the AdminUI @lauriejim works fine its when you attempt to delete using the endpoint. |
I was trying with the content manager. Let me test again with the API. |
I think the issue is here: strapi/packages/strapi-generate-api/templates/bookshelf/service.template Lines 129 to 144 in 3a62e9e
At least comparing it to the Mongo Template here: strapi/packages/strapi-generate-api/templates/mongoose/service.template Lines 107 to 146 in 3a62e9e
Though I'm not entirely sure how to fix this myself. |
Thats if this template is what is being used to generate the files with the adminUI |
Informations
What is the current behavior?
If a model has a relation (in my testing on a fresh clean project, a many to one) you cannot delete data, provided the following error:
Steps to reproduce the problem
I created two models
system
andbody
which you can see below. Deleting works fine on both system and body if there is no relation between them. However if I add a relation between them, in my case onesystem
can have manybody
I am provided with the error listed above.System Model:
Body Model:
What is the expected behavior?
The delete function should work with or without a relation field
Suggested solutions
Modify the services file for MySQL to properly account for relations.
@lauriejim this is a breaking issue with MySQL, Relations, and Deletion.
The text was updated successfully, but these errors were encountered: