leftJoin Remove
leftJoin Remove
Restful Web Services
Posts: 202Questions: 49Answers: 2
in Editor
Can someone confirm to me whether or not when I delete an item from a database table if any left join items are also supposed to be deleted at the same time? Mine are not. I can't find in the documentation, although it is probably there, if it is supposed to remove join records or not.
Thanks
This question has accepted answers - jump to:
This discussion has been closed.
Answers
I am doing left join deletes all the time but it is not Editor that does them. It is the DBMS! Just implement a foreign key and set DELETE CASCADE. If you are using a link table between two tables you can have the link table entry deleted with DELETE CASCADE. But you would have to manually delete the other table. I do this on "postRemove" of the primary table.
In this example I didn't implement a foreign key relationship in the DBMS so I have to manually delete the left joined record:
Found this one too. Allan confirms that Editor shouldn't do left join deletes.
https://datatables.net/forums/discussion/44547
Great, thanks for the information. I have implemented a delete to manually remove the child items using the
preRemove
event but I might change to DELETE CASCADE as you suggested.Thanks
Yes, this is something that I feel should be done by the database as well - its faster and more maintainable .
Allan