开发者

Two tables: order and order_status. Relationship or enum type? What kind of relationshi

I have two tables: order and order_status.

In the first one I store 开发者_C百科the orders of a shop and in the second one the different possible statuses that an order can have (in progress, paid, ...).

Should be there a relationship (1:1??) between these two tables or should I just create an ENUM type for the status values?


Go ahead and create the table. You will need more statuses over time (trust me, I work on 20,000 online stores every day, and OrderStatus is NOT as simple as it sounds). This will also let you add flags the statuses: some answers may count as a form of "shipped", even if their descriptions vary.


I usually do enum type for the status values. This way I don't have to hit the database each time I want to do a lookup for a dropdown etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜