B
B
Berkutman2020-07-28 17:39:42
Software design
Berkutman, 2020-07-28 17:39:42

The principle of generating an id for an order?

By what principle is it worth generating an order number and at the same time writing it to the database?

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
Daria Motorina, 2020-07-28
@glaphire

Id, which is the primary key in the orders table, is sufficient

I
Ilya, 2020-07-28
@New_Horizons

random of course

A
Andrey, 2020-07-28
@VladimirAndreev

if an order can be viewed by its id on the Internet without registration and SMS, and it should not be possible to view other people's orders, I would use the current date and a 9-character random number when generating the id, that is,
20200728123456789

D
dmitriy, 2020-07-28
@dmitriylanets

Depending on the purpose, it is clear that the database has a unique id, but for the client it can contain anything, for example, the id of the outlet + serial number

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question