P
P
Prodion2019-12-22 18:47:19
Database design
Prodion, 2019-12-22 18:47:19

Database for an online store?

If the tables are:
- Manufacturers (manufacturer) - Collections (collection) - Colors (color)
A manufacturer can have many collections, but a collection has only one manufacturer. A collection can have many colors, but a color has only one collection. Do I understand correctly that you need to use a one-to-many relationship?
Main problem:
A collection must have characteristics. Weight, grams, composition, etc. How it is better to implement it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin, 2019-12-23
@PRodion

Three tables:

manufacturers
id | name | что-то | еще |

collections
id | manufacture_id | name | Вес | грамм | состав  | т.д.  |

colors
id | collection_id | name | что-то | еще |

Manufacture->hasMany(Collection); Collectiion->hasMany(Color); ну и в обратную сторону belongsTo()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question