Answer the question
In order to leave comments, you need to log in
How to properly organize the database structure of an online store?
I want to write an online store from scratch, mini-cms, to understand this issue from the inside. I sketched a diagram in the workbench, could you evaluate and help correct the bad places in this diagram?
Answer the question
In order to leave comments, you need to log in
1. Besides Adjacency List (as in your case) there are other tree types like Nested Sets, Materialized Path, Closure Table etc. They differ in the speed/complexity of various operations (adding, deleting, moving, selecting). Although all problems are solved by caching.
2. Why put product images in a separate table? It is enough to create an images field and store a serialized array of paths there.
3. The structure of the basket is also not clear. It is easier to create in the basket (*carts) table the customer_id fields and the products field (also a serialized list of products in the basket). It's even better to store the cart data in the session.
There was a post on Habré, it was called a serious design of an online store. Or something very similar. There was more and more serious, maybe it will help you.
Alternative: find an open source solution, download it, look at the structure there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question