W
W
weranda2022-04-06 19:15:01
Database design
weranda, 2022-04-06 19:15:01

Where is the best place to place order statuses in the database?

Greetings.
There is a part of a DB. The database stores information about orders. Three people work with the order. Where to store order statuses? In a separate table , in an order table, or in some other way ?

This is how a piece of the database might look like:
624dbc37aee8c116736317.png

Or a piece of the database might look like this (we transfer the statuses directly to the order table):
624dbc4f315cb014765058.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Elena, 2022-04-08
@lenk0belk0

In this situation, it seems better to store order statuses in a separate table.
There is a table of orders order(id).
There is a table of users user(id)
There is a table of statuses status(id)
There is a table of statuses order_status(id(?), order_id(order.id), status_id(status.id), assignee_id(user.id), created_at)
Thus, it will be it is known: what is the current status of the order, who is currently handling the order, it will be possible to trace the history of changes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question