I am struggling to find a better approach on the following topic and would appreciate any advice.
1. Description:
Database purpose - warehouse storage. There are a couple of entities such as:
- t_resource (from what the product made).
- t_product (the final product whichis made from resources).
- t_rack where the items are stored.
- t_item which can be type of product or resource.
2. Problem:
How to abstract resources and product in a way that they can fit into the item and be easily searchable later on.
3. My thoughts and possible solution:
- Introduce into the t_item table column with name "type" which will help to differentiate the id`s of resource and product -> there seems big disadvantages of this approach especially if I would like to join representative table to bring product and resource details.
- Introduce independent tables for the t_rack storage and split into t_rack_res and t_rack_product -> this solution probably will have same problem when there will be need to show all the items from both of the tables. Also later if there will be need to scale the item type, I will fall into the problem of creating another table.
- Merge product and resource into one table - the only reason I don't like this idea is that, practically those two things are different and should be separate also because product should be made from resources and contain it.