2012-08-29 25 views
0

我有一个数据库用于管理商店系统的产品/项目。表结构看起来像根据新要求修改架构

Categories 
---------------------------- 
id 
name 
description 
active 
created 
modified 



Products 
---------------------------- 
id 
name 
description 
active 
created 
modified 
id_category 

现在我有兴趣使用此数据库的多个商店。什么是修改模式的最佳方式。通过在每个表中添加一个id_shop?还是有更好的办法

谢谢

+0

类别和/或产品应该可以在多个商店之间共享吗?换句话说,我们是在谈论1:N还是M:N关系? –

+0

[Multiple schemas versus huge tables]可能的重复(http://stackoverflow.com/questions/8340721/multiple-schemas-versus-enormous-tables) –

回答

0
Shops 
---------- 
shop_id 
ShopName 
AhopAddr 
... 

Categories 
---------------------------- 
id 
name 
description 
active 
created 
modified 
shop_id 

Products 
---------------------------- 
id 
name 
description 
active 
created 
modified 
id_category 
shop_id 
0

我认为一个基本的妥协是以下模式

enter image description here

在这种情况下,你可以广告多类单品