public.orders
Description
Labels
svc-smarttab
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| id | uuid | false | public.bills public.order_items | |||
| device_id | uuid | true | public.devices | |||
| customer_id | integer | true | public.customers | |||
| order_number | varchar(50) | false | ||||
| table_number | varchar(50) | true | ||||
| subtotal | numeric(12,2) | 0.00 | false | |||
| tax | numeric(12,2) | 0.00 | false | |||
| total_amount | numeric(12,2) | 0.00 | false | |||
| status | varchar(50) | true | ||||
| created_at | timestamp with time zone | now() | true | |||
| updated_at | timestamp with time zone | now() | true | |||
| merchant_id | integer | false | public.merchants | |||
| store_id | integer | false | public.stores |
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