stock_movements table

The stock_movements table in the Inventory Management Database Schema schema has 10 columns, keyed by id, with 2 foreign keys to products and locations.

The ledger. quantity is signed: positive adds, negative removes. reference_type and reference_id point back at the receipt, transfer or count that caused it.

Columns (10)

Columns of the stock_movements table
ColumnTypeConstraintsDescription
iduuidprimary key
product_iduuidnot null, references products.id
location_iduuidnot null, references locations.id
typemovement_typenot null
quantityintegernot null
unit_cost_centsinteger
reference_typevarchar(40)
reference_iduuid
performed_byvarchar(120)
occurred_attimestamptznot null

Indexes (3)

  • (product_id, occurred_at)
  • (location_id, occurred_at)
  • (reference_type, reference_id)

Relationships