Track store inventory

-2

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?

    
asked by anonymous 29.05.2016 / 16:39

1 answer

1

My view of the context:

A table for products; A table for moving inventory.

In the handling table you would control the inputs and outputs of the products. Putting everything into a table will only give your application scalability.

    
29.05.2016 / 18:41