我有一个关系表,它通过同一列上的外键(删除级联)链接主表上的两行。这是我在关系表上设置的关系:
http://screencast.com/t/6DQ3rfQrYr
这两列是关系中行的ID。
我想对主表上的id执行删除,如果它在关系表中链接,我希望将关系与关系中的行一起删除。现在,只删除从主表中删除的行和关系。为什么与删除的行的关系中的行也不会被删除?
这是关系表: http://screencast.com/t/znLKgvGXb5aR
这是主表: http://screencast.com/t/Ilir768wekL
Desired flow:
Delete on main ->
(if in relation) Delete the row, delete the row in relation and the relation
(if not in relation) nothing
Current flow:
Delete on main ->
(if in relation) Delete the row and the relation
(if not in relation) nothing