How to do recursive deletions

I have entities for Machines, Machine Groups, and MachineGroupMembers.  The MachineGroupMembers entity has FK reference to MachineId and MachineGroupId.

To delete a Machine Group that has members defined in MachineGroupMembers gives me a FK constraint error.  I have to navigate to the Machine Group Show page and delete the members from the group and then navigate back to the Machine Groups page and delete the group.

How do I modify the delete action of a machine group to delete all references to it from the MachineGroupMembers table?


HI Craig,

There are two things that you can do, one is make a bulk delete on  MachineGroupMembers with the id you want to delete, the other one is in the service studio go to the properties of the forgain key and there are a on delete property, by default it should be protect, you need to set it as delete, by doing this you are setting the DELETE ON CASCADE option in SQL. 
I don't have Service studio installed in this machine but tomorrow morning I will put here some screen shoots to help you .

Best regards,
Carlos Rocha
Thanks, Carlos!
Hi Craig,
I don't know If you was able to do it or not but I'm posting here the images that I promised


Carlos Rocha