我正在考虑使用一个image表来存储任何其他独立表的图像,例如user,product等等...(当然,独立表的任何单个实例(例如John Smithas auser和laptopas a product)可能有 0、1 或多个images .
该image表有id和。titlefilename
而且我正在考虑一个imagetable表格,将images 与它们的正确image owners 相关联,例如user这些字段image_id:table_id和table.
一些条目可能如下所示:
image_id | table_id | table
-----------------------------
1 | 1 | user
2 | 1 | user
3 | 2 | user
4 | 2 | user
5 | 1 | product
6 | 1 | product
7 | 1 | product
8 | 2 | product
9 | 3 | product
10 | 3 | product
11 | 4 | product
现在的问题是:
是否建议使用此数据库设计?处理此请求的最佳方法是什么?
当然,另一种方法是使用user_image,product_image和company_image表而不是单个image_table表。