如果我有以下表格:
Product
+----+------+
| id | name |
+----+------+
| 1 | box |
| 2 | car |
| 3 | ball |
+----+------+
Color
+----+-------+
| id | name |
+----+-------+
| 1 | red |
| 2 | green |
| 3 | blue |
+----+-------+
Size
+----+--------+
| id | number |
+----+--------+
| 1 | 1 |
| 2 | 5 |
| 3 | 10 |
+----+--------+
Color Options (#product | #color)
+---------+-------+
| product | color |
+---------+-------+
| 1 | 1 |
| 1 | 3 |
| 3 | 1 |
| 3 | 2 |
| 2 | 3 |
+---------+-------+
Size Options (#product | #size)
+---------+-------+
| product | color |
+---------+-------+
| 1 | 1 |
| 1 | 2 |
| 3 | 1 |
| 3 | 2 |
| 2 | 2 |
| 2 | 3 |
+---------+-------+
当我删除产品时,删除它与颜色和尺寸的关系的最佳方法是什么?我需要在每个表中进行删除还是有任何自动过程?