adding one time options to items
I'm building an Event Registration site. For any given event, we'll have a handful of items to choose from. I have a table for these items. For each event we might have special options for users. For example, for one of the events new users get to buy an item which is not available to other users. This may not apply to all the events. For other events we might have some other restriction on 开发者_如何学编程items. I will obviously be checking this programmatically on application side. I would like to though, set up a column containing flag in the items table. But I don't find it feasible because this condition may only apply to one particular event. I don't want all the future items to have this column. What is a good approach to take in such a situation? Should I create a special "restrictions" table and just do a join? How would I handle this on the application side?
Yes, you are going to need an additional table with the list of items that have special rules. It sounds like the 'special options' idea is still evolving, so it's probably too early to know whether to think of it as containing 'restrictions' or 'bonuses'
And of course you'll probably need another table which maps items to particular groups of users.
General advice in this sort of situation: you should do something simple until the spec gets at least semi-frozen. I've just gone through it myself: the marketing guys had all kinds of ideas about special deals and discounts. If I had taken the time to build the perfect engine, it would have gotten tossed a month later when they changed direction.
精彩评论