I am building an inventory system for a plant nursery. The company has products, plants, and services that they sell, which will all be tracked.
For the plants, other attributes will be stored, like mature height and width, as well as whether the plant provides shade or not.
I am wondering how I should structure the database for these items. Should they each have a separate database table, or should they all be in the same table, with a one to one relationship for the products to plants to store the extra information?
@cwray-tech Treat it as any other e-commerce project. You have products that people can buy (or I’m guessing subscribe to since you mention services).
If people can buy plants, then a plant is just a product itself. Stuff like mature height and width, and whether the plant provides shade, is just metadata about that particular product. Things like whether the plant provides shade or not, is not going to have any effect on the logic of adding the plant product to a cart and checking out.
So, would you just add columns to the product table for the metadata and show/hide options to fill in data based on the type of product? ex: if a user selects the product is a plant, then show the forms to fill in the metadata.