inventory_movements table
The inventory_movements table in the E-commerce Database Schema schema has 7 columns, keyed by id, with 1 foreign key to inventory_items.
Append-only ledger. quantity is signed. inventory_items.on_hand is the running total and can always be rebuilt from here.
Columns (7)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| inventory_item_id | uuid | not null, references inventory_items.id | |
| type | inventory_movement_type | not null | |
| quantity | integer | not null | |
| reference_type | varchar(40) | ||
| reference_id | uuid | ||
| occurred_at | timestamptz | not null |
Indexes (1)
(inventory_item_id, occurred_at)
Relationships
inventory_movements.inventory_item_idreferencesinventory_items.id