public.orders
Description
Labels
svc-smarttab
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| id | uuid | false | public.bills public.order_items | Order identifier (UUID). | ||
| device_id | uuid | true | public.devices | Device ID that created this order. | ||
| customer_id | integer | true | public.customers | Customer ID (optional for walk-in). | ||
| order_number | varchar(50) | false | Order number (unique within store). | |||
| table_number | varchar(50) | true | Table number for dine-in orders. | |||
| subtotal | numeric(12,2) | 0.00 | false | Order subtotal amount. | ||
| tax | numeric(12,2) | 0.00 | false | Order tax amount. | ||
| total_amount | numeric(12,2) | 0.00 | false | Order total amount. | ||
| status | varchar(50) | true | Order status: OPEN, PAID, CANCELLED. | |||
| created_at | timestamp with time zone | now() | true | Record creation timestamp. | ||
| updated_at | timestamp with time zone | now() | true | Record last update timestamp. | ||
| merchant_id | integer | false | public.merchants | Parent merchant ID. | ||
| store_id | integer | false | public.stores | Parent store ID. |
Viewpoints
| Name | Definition |
|---|---|
| Order & Billing | Order lifecycle — Orders → Bills → Payments → Settlements |
Constraints
| Name | Type | Definition |
|---|---|---|
| orders_merchant_id_fkey | FOREIGN KEY | FOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT |
| orders_customer_id_fkey | FOREIGN KEY | FOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE SET NULL |
| orders_store_id_fkey | FOREIGN KEY | FOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT |
| orders_device_id_fkey | FOREIGN KEY | FOREIGN KEY (device_id) REFERENCES devices(device_id) ON DELETE RESTRICT |
| orders_pkey | PRIMARY KEY | PRIMARY KEY (id) |
Indexes
| Name | Definition |
|---|---|
| orders_pkey | CREATE UNIQUE INDEX orders_pkey ON public.orders USING btree (id) |
| ix_orders_created_at | CREATE INDEX ix_orders_created_at ON public.orders USING btree (created_at) |
| ix_orders_customer_id | CREATE INDEX ix_orders_customer_id ON public.orders USING btree (customer_id) |
| ix_orders_device_id | CREATE INDEX ix_orders_device_id ON public.orders USING btree (device_id) |
| ix_orders_order_number | CREATE INDEX ix_orders_order_number ON public.orders USING btree (order_number) |
| ix_orders_status | CREATE INDEX ix_orders_status ON public.orders USING btree (status) |
| ix_orders_merchant_id | CREATE INDEX ix_orders_merchant_id ON public.orders USING btree (merchant_id) |
| ix_orders_store_id | CREATE INDEX ix_orders_store_id ON public.orders USING btree (store_id) |
Relations
Generated by tbls