I wanted to make sure the design for a particular part is correct or not.
The scenario is : A pizza can be customized by its size,toppings,crust etc.But the prize of toppings will depend on the size ;like when size 7" is selected the prize for each topping will be $1 and for size 14" the prize will be $2 (or some other customization can be dependent on some other one).One of the customization can be available only for a particular size;like when size 7" is selected then only another customization will be displayed.
(This scenario is just an example and there are many more things other than pizza which will have customization as it is a food ordering app )
Currently for this problem ive designed 3 tables.
the customization table will hold the name of customization like size,crust,toppings etc.
And the options table will hold the contents of each customization.
The parent_id in options will refer the same table in order to satisfy the condition of previously selected options.
c_id d_id name
1 1 size
2 1 toppings
o_id c_id parent_id name price
1 1 1 7" 5$
2 1 2 14" 10$
3 2 1 abc 1$
4 2 2 abc 2$
Is there any better way of representing this in the db.
Please guys revert back as soon as possible and please suggest any other changes or functionality I should include in the design(other than this part too).
It will be great if any helpful links are provided.