Sep 5, 2019
0
Level 1
Best schema for products with variety of attributes
We will have millions of products with variety of attributes in laravel. I am going to make it relation with 4 tables.
Products -> id, name, description
Attributes -> id, name
Attributes_value => id, name
product_attribute => id, product_id, attribute_id, attribute_value_id
Sample data:
Products
id, name, description
1, T-shirt, attractive look for men
Attributes
id, name
1 color
2 size
Attribute_value
id, name
1 black
2 red
3 yellow
4 medium
5 large
Product_attribute
id product_id attribute_id attribute_value_id
1 1 1 1
2 1 1 2
3 1 2 5
Please let me know, how it is for products listing. Any suggestion is also appreciated.
Please or to participate in this conversation.