I'm trying to model a database that tracks building complex recipes.
This is what I have so far.
- Table A - recipes (Id, name, description, servings, time, temp ... etc)
- Table B - Ingredients (raw materials)
- Table C - Recipe Ingredients (fk recipeID, fk ingredient ID, amounts of ingredient per receipe)
- Table D - Recipe Steps (fk recipe ID, steps to produce recipe)
The next stop is creating a model to create products by combining portions from multiple recipes to make 1 product. For instance, a pie consists of x amt of dough, y amt of filling and z amt of a topping.
Dough gets made in batches of 10x, Filling gets made in batches of 15y and topping gets made in batches of 20z
- Table E Component (name)
- Table F Component_pieces (fk recipesID, amt)
Some of these components are end products and can't really be combined to create a new product (like Apple Pie).
The problems is that other components can be combined with portions from the recipes and ingredients to make another, 3rd tier product. For instance, a 10" cake consists of 3 tiers of 10" cake (3 10" cake components) + X amt of filling (a recipe) + Y amt of Fondant (an ingredient).
How do I build a model that an represent both making a pie and making a complex cake without lots of duplication?
Thanks in advance.