Closed
Description
Currently, DataJoint implements its own cascading deletes instead of relying on MySQL's native cascading deletes.
This solution
- allows reviewing the contents to be deleted
- compensates for MySQL's multiple-path problem for cascading deletes
dj.BaseRelvar/del
generates the lists of all dependent tables and deletes from them, starting from the bottom. Each delete is restricted by the top relation. This rule works well when all foreign key fields are also primary key fields in the tables involved but can result in deleting non-dependent tuples if one of the tables along the cascade includes non-primary fields in its foreign key.
This issue may be fixed by simply not cascading down from any table that does not include all its foreign key fields in their primary key.