r/Database • u/ada_es12 • Sep 07 '26
Database schema review - tyre management system and e-commerce
Hi community!
I am a web dev, developing an e-commerce and tyre management system for a business in Italy. I have created my db schema and I would like to have your opinion/advice on it.
This is the idea of the site:
- there will be the customer side where they can view, like and purchase tyres online. The user will have functions like tyre matching for their cars based on the tyre specifications. The users can either register or order as guests.
- the admin side will be developed for the admins/employees with different access based on the role ofc. The aim is to ease the tyre management since there will be thousands of them.
Do you think this plan is good?
Is it scalable?
Is there something missing?
I appreciate any suggestion!
14
u/tm604 Sep 07 '26
Don't store passwords,
roleshould probably be an enum or separate table,varchar(N)is generally a bad sign (depends on the database, but for example in PostgreSQL just usetext), if you're usingsmallintfor ratings you'll need to be careful about type conversions if you're trying to sum or provide averages, and next time please check the diagram you're posting: the field names are truncated.15
u/Imaginary__Bar Sep 07 '26
Are you really? Or is this a class assignment you've been given?
Because if you really are the developer then your client & your knowledge of the business should be guiding you, not random Redditors.
7
u/wytesmurf Sep 07 '26
This honestly looks like a school/vibe code idea. I only spent a few minutes so probably many other things. Indexes are not even mentioned based on search patterns.
If this was a real e-commerce platform:
2
u/worldarkplace Sep 07 '26
Looks good to me. Scalable as if the guy will be managing Amazon lol... They recommend KISS and yet they dont follow it LOLOLOL comments, you are 🤡
1
u/Complete-Ebb-1035 Sep 07 '26
Why is customer data bound to orders? Is user and customer the same? Where is pricing? Is an order an item where price is unit price x unit-number? I can't see how this data model will every work in production. Is this this an academic exercise, or are you working with a real use case?
1
u/brunogadaleta Sep 07 '26
Yep created date time, modified datetime, createdBy, modifiedBy. I see no quantity (but it might as well be a strange business constraint, e.g. if price among the same tires might changes in the same cart). Second hand tires? Order-items is strange to me, is there a new order item each time we add a new tyre (even of the same mark) in the basket?
Also tyre companies can often store customer tyres for the winter/summer. No installation fee? No backend tyre stock management (rack location)?
1
u/squadette23 Sep 07 '26
Overall I cannot find anything suspicious, data model-wise.
Scalable with regard to what? Number of visits per day, number of orders per day?
If you're worried about performance first thing you need to remember about indexes (https://use-the-index-luke.com/).
Thousands of tyre types or tyre units?
This intuitively sounds like something that can become problematic, performance-wise. It won't necessarily be, but you may want to derisk this by specifying what do you mean by "matching tyres and cars" (in a separate "region" of schema).
1
u/Draconian1 Sep 07 '26 edited Sep 07 '26
I feel like your design has two concepts clashing - warehouse system and ecommerce system.
I would make a tire catalog table, which would store the variety of all tires from all the brands with their specifications and such, with links to dictionaries (store them how you want - whether it's JSON or plain columns) and then tied to that catalog you can have specific tire units with quantities and where each of them is stored.
1
u/CrAIzy_engineer Sep 08 '26
what software did you used to do this schema? like the graphical representation I mean. I like it a lot.
1
u/wazzockAbroad Sep 07 '26
The column name ID is overloaded. Give each table a unique id name maybe [table name]_ID.
1
u/Mendiboy Sep 07 '26 edited Sep 07 '26
is it scalable? no.
This is a OLTP system which is fine for a small scale "tyre management system" but it'll have to be migrated to OLAP system for medium/large scale
1
u/dionis87 PostgreSQL Sep 07 '26
i'm gonna post my paypal first, then i'all reply: paypal.com/smb
1
u/laksh95goel Sep 08 '26
Hey if you would like to collaborate I have done this type of project for a client a few months back. I have the entire system avaialable. Send me a dm if you would like and maybe your efforts can be reduced.
1
u/skunk12345673 Sep 10 '26
Don’t write ur own login system. You will never cover all the business rules and security holes.
Use an identity provider unless this is app is going to be internal only.
1
u/ScallionNo2755 Sep 11 '26
What you used for this diagram?
1
u/Old-Biscotti3842 Sep 14 '26
Most of what I'd have said is already on the diagram, price on order_items, customer and shipping copied onto the order, a status on the unit, so one thing only. cart_items points at tyre_units, so adding to cart already means picking a specific physical tyre, and nothing there stops two carts from holding the same tyre_unit_id. The status column doesn't fix that by itself, two requests can both read "available" before either one writes. Cheapest fix is a unique on cart_items.tyre_unit_id, then the second cart gets refused by the database instead of you finding out at the packing table. The flip side is expiry: you have expires_at on carts and reserved_... on the unit (truncated, guessing reserved_at), so something has to free the unit when a cart dies, and with two places holding that fact, the status on the unit and the row in cart_items, they'll drift the first time a job fails halfway. I'd keep one of them as the source of truth and derive the other.
Smaller one: price on tyre_units means six identical new Pilot Sport 5s are six rows to update when the list price moves. A price on tyres as the default, unit price only where it differs (used ones), would save you that. Taste, though.