[英]How to debug mysql foreign key constraint, ON DELETE CASCADE not deleting rows from Child table on production environment
[英]On foreign key delete destroy child rows?
我对使用外键很陌生,在 MySQL 网站上找不到任何东西。 这是我的数据库结构:
hosts
id
etc.
events
id
host_id
etc.
一个或多个events
属于一个host
。 当host
被删除时,我需要删除所有附加到它的events
。 我怎样才能做到这一点?
谢谢!
用例 cade 正确删除
您可以在此处查看详细信息-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.