dimanche 8 avril 2018

Most efficient way to structure MySQL Database with categories for shop, blog, and services

I am creating a custom blog, shop and services area for a customer.

What is the most efficient way to structure a 'category' for each of these.

I was thinking of designing the relational database like so. Here are the names of the tables.

Articles
articles
article_cateogries

Products
products
product_cateogries

Services
services
service_categories

OR

Articles
articles

Products
products

Services
services

Categories
categories
Columns: (id, name, product_id, article_id, service_id)
Where type is a product, service, or category

The second solution I'd be able to have one category and use it for articles, services and products. I need something scale-able and doing a category for each of the above doesn't make sense and would be a nightmare.

I just don't want a whole bunch of null-able ID fields.

If anyone has any scale-able solutions, let me know! Thanks!

Aucun commentaire:

Enregistrer un commentaire