purchase_orders table
The purchase_orders table in the Inventory Management Database Schema schema has 12 columns, keyed by id, with 2 foreign keys to suppliers and warehouses. 2 columns in purchase_order_lines and goods_receipts reference it.
Money in minor units as integers. Totals are snapshotted when the order is sent.
Columns (12)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| supplier_id | uuid | not null, references suppliers.id | |
| warehouse_id | uuid | not null, references warehouses.id | |
| number | varchar(32) | unique, not null | |
| status | purchase_order_status | not null | |
| currency | char(3) | not null | |
| subtotal_cents | integer | not null | |
| tax_cents | integer | not null | |
| total_cents | integer | not null | |
| ordered_at | timestamptz | ||
| expected_at | date | ||
| created_at | timestamptz | not null |
Indexes (2)
(supplier_id, ordered_at)(status, expected_at)
Relationships
purchase_orders.supplier_idreferencessuppliers.idpurchase_orders.warehouse_idreferenceswarehouses.idpurchase_order_lines.purchase_order_idreferencespurchase_ordersgoods_receipts.purchase_order_idreferencespurchase_orders