Skip to content

public.orders

Description

Labels

svc-smarttab

Columns

NameTypeDefaultNullableChildrenParentsComment
iduuidfalsepublic.bills public.order_itemsOrder identifier (UUID).
device_iduuidtruepublic.devicesDevice ID that created this order.
customer_idintegertruepublic.customersCustomer ID (optional for walk-in).
order_numbervarchar(50)falseOrder number (unique within store).
table_numbervarchar(50)trueTable number for dine-in orders.
subtotalnumeric(12,2)0.00falseOrder subtotal amount.
taxnumeric(12,2)0.00falseOrder tax amount.
total_amountnumeric(12,2)0.00falseOrder total amount.
statusvarchar(50)trueOrder status: OPEN, PAID, CANCELLED.
created_attimestamp with time zonenow()trueRecord creation timestamp.
updated_attimestamp with time zonenow()trueRecord last update timestamp.
merchant_idintegerfalsepublic.merchantsParent merchant ID.
store_idintegerfalsepublic.storesParent store ID.

Viewpoints

NameDefinition
Order & BillingOrder lifecycle — Orders → Bills → Payments → Settlements

Constraints

NameTypeDefinition
orders_merchant_id_fkeyFOREIGN KEYFOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT
orders_customer_id_fkeyFOREIGN KEYFOREIGN KEY (customer_id) REFERENCES customers(id) ON DELETE SET NULL
orders_store_id_fkeyFOREIGN KEYFOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT
orders_device_id_fkeyFOREIGN KEYFOREIGN KEY (device_id) REFERENCES devices(device_id) ON DELETE RESTRICT
orders_pkeyPRIMARY KEYPRIMARY KEY (id)

Indexes

NameDefinition
orders_pkeyCREATE UNIQUE INDEX orders_pkey ON public.orders USING btree (id)
ix_orders_created_atCREATE INDEX ix_orders_created_at ON public.orders USING btree (created_at)
ix_orders_customer_idCREATE INDEX ix_orders_customer_id ON public.orders USING btree (customer_id)
ix_orders_device_idCREATE INDEX ix_orders_device_id ON public.orders USING btree (device_id)
ix_orders_order_numberCREATE INDEX ix_orders_order_number ON public.orders USING btree (order_number)
ix_orders_statusCREATE INDEX ix_orders_status ON public.orders USING btree (status)
ix_orders_merchant_idCREATE INDEX ix_orders_merchant_id ON public.orders USING btree (merchant_id)
ix_orders_store_idCREATE INDEX ix_orders_store_id ON public.orders USING btree (store_id)

Relations


Generated by tbls

MPAC — MP-Solution Advanced Cloud Service