D
D
darksladen2017-07-23 12:12:42
Database
darksladen, 2017-07-23 12:12:42

How to make order statuses in the database correctly?

Tell me, how would it be better to make different statuses in the database (paid, delivery, not paid)? There are many options, but I still don’t know how it would be
better
. fields
3) As in option 1, but only make the identifier not a numeric one, but a string one (delivery, paid, etc.)
I tend to option 1, but you can get confused later what status means what .. How would you do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Tsvetkov, 2017-07-23
@tsklab

make different statuses in the database (paid, delivery, not paid)
By linking the order table with the documents in the above table of payment, delivery. Specify the status in the view (if there is a payment, paid, and so on).

D
d-stream, 2017-07-23
@d-stream

Option 2 is closer to reality.
Only in fact, some statuses may not be quite bool
For example, the same delivery may turn out to be “packaging”, “assembly”, “packing”, “transfer to courier / shopping mall”, “delivery”
Yes, and payment by and large can be different " prepaid", "there is a copy of the PP", "money received"

A
aynur_safin, 2017-07-23
@aynur_safin

(paid, delivery, not paid)

Why reset other fields, do they contradict each other?
(well, except for "not_paid / paid", but it should be one field).
Total two boolean fields: paid and delivery.
If you need one status for the interface of these (not paid -> paid -> delivery),
then you can make an additional dynamic field (without writing to the database):
Well, or more difficult, if statuses like "Not paid / Delivery" are possible, for example, with post-payment.
Those. at the same time, you will be able to flexibly change the program logic later by combining status conditions, no matter how many there are.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question