I'm in a virtual store project and I have a question about the stock control process.
Initially I'm doing everything in the product
table where I have two fields: manage_stock
and stock
. Manage Stock will control whether the product will have stock control at the time of sales and Stock is the stock in question.
When an order has its status marked as paid I direct decrease in the product in column stock
.
Following table structure:
Tabela product
id name manage_stock stock
1 Mouse 0 NULL
2 Teclado 1 50
3 Monitor 1 10
4 Gabinete 0 5
Table product
Is this logic correct? or I should create a stock-only table by linking the product. Is stock reduction a simple direct decrease in the produtc
table?