I am having Product table where I am having multiple product category, and different product category have different attribute. as given is my table design
images ----- id desc url timestamp images ---- image_id imagesable_id (refer multiple table id) imagesable_type (type of model targeted) product --------- id user_id (refer user) title subtitle price metaData timestamp Category -------- id Category parent_id timestamp product_category ----------------- category_id (refer category) product_id (refer product) Attribute ---- id attribute timestamp attribute_value ----- id attribute_id product_id value timestamp
Where product->metadata Store the value in json to avoid joins.
want to know is this approach is good or should i use some other way and also want to implement filters
like if some one select music i should able to filter product according to artiste and if some one searches book i should able to filter the product by author.
please give me proper guide how should i do to make database clean and optimized way.