Inventory
Per-SKU stock levels and reorder-point settings for each Base SKU at each Warehouse.
The inventory tables track how much stock exists for each product at each location and the settings that drive reordering. The main Inventory table holds one row per Base SKU per Warehouse, while inventory_formula_inputs stores the global defaults for the reorder formula.
Inventory
One row represents the stock of a single Base SKU at one Warehouse. Each row also carries the five reorder-point levers used to decide when and how much to reorder. These levers match the "Reorder Point Settings" feature screen.
| Column | Type | Notes |
|---|---|---|
| id | integer | Primary key. |
| Inventory_Name | text | Human-readable name for the inventory row. |
| Warehouses_id | integer | → references Warehouses. The location holding the stock. |
| base_sku_id | integer | → references Base SKUs. The product being stocked. |
| brand | integer | → references Brands. Must be greater than 0. |
| Units_Remaining_in_Stock | bigint | Current on-hand units. |
| Current_Inbound_Inventory | bigint | Units on inbound purchase orders. Default 0. Maintained by trigger (see below). |
| Shipped_in_last_14days | bigint | Rolling shipped-units count used to estimate daily demand. Default 0. |
| safety_stock_to_hold_in_days | bigint | Reorder lever: days of buffer stock to hold. Default 3. |
| trailing_days_to_measure_daily_demand | bigint | Reorder lever: window used to measure daily demand. Default 14. |
| replen_order_lead_time | bigint | Reorder lever: expected lead time for a replenishment order, in days. Default 10. |
| order_interval | bigint | Reorder lever: days between reorders. Default 7. |
| base_sku_order_multiple | integer | Reorder lever: order quantities are rounded to this multiple. Synced with the Base SKU (see below). |
| created_at, updated_at, created_by, updated_by | timestamp / varchar | Standard audit columns. created_at defaults to now(). |
Automation. Current_Inbound_Inventory is denormalized. The trigger_update_inventory_sum trigger on Inventory Purchase Order Line Items recomputes this value for the affected Inventory row whenever PO line items change. See Automation.
Two-way order_multiple sync
base_sku_order_multiple is kept in sync between Inventory and its linked Base SKU. On the Inventory side, update_base_sku_order_multiple_for_inventory (AFTER UPDATE) and update_base_sku_order_multiple_for_inventory_2 (AFTER INSERT) push the multiple back to the Base SKU. On the Base SKU side, the sync_base_sku_order_multiple_with_inventory trigger pushes changes the other direction. Update the value in either place and both stay aligned.
External notifications
The inventory_update_trigger (AFTER INSERT/UPDATE) calls notify_n8n_inventory_update(), which notifies an external n8n workflow whenever inventory changes. See the full trigger catalog in Automation.
An Inventory row links to a Warehouse, a Base SKU, and a Brand. Together the Warehouse and Base SKU identify what stock this row represents; the Brand records which brand owns it.
inventory_formula_inputs
Standalone configuration that holds the global default values for the reorder formula. It has no foreign keys and is not tied to any single SKU or warehouse. These defaults back the per-SKU levers stored on the Inventory table.
| Column | Type | Notes |
|---|---|---|
| id | integer | Primary key. |
| Trailing_Days_to_Measure_Daily_Demand | bigint | Default trailing window for measuring daily demand. |
| Safety_Stock_to_Hold____of_Days_ | bigint | Default days of safety stock to hold. |
| Order_Interval | bigint | Default days between reorders. |
| created_at, updated_at, created_by, updated_by | timestamp / varchar | Standard audit columns. |
This table stands alone. It has no relationships to other tables; it simply supplies default values that are copied onto the reorder levers of each Inventory row.