Topic: Saving Data in a Serialized Hash vs Relationship
I have a pretty basic question and I hope someone can help me out with the theory/modeling.
Our database has inventory items, some of which can be bought from various suppliers. I can setup the relationships but the problem I'm running into is how to model and store the pricing. Each vendor gives different pricing and different quantity breakdowns.
- Supplier 1
10 units or less - $3.43 per unit
50 units or less - $3.20 per unit
- Supplier 2
20 units or less - $3.33 per unit
90 units or less - $3.10 per unit
I would like to be able to save all this information but am not sure if it's best in a serialized hash directly on the products_suppliers table or as another relationship. I would like a method that will be able to put in an item and quantity and pull the best price, so that's the end goal.