public.bill_operation_histories
Description
Labels
svc-smarttab
Columns
| Name | Type | Default | Nullable | Children | Parents | Comment |
|---|---|---|---|---|---|---|
| id | uuid | gen_random_uuid() | false | |||
| merchant_id | integer | false | public.merchants | |||
| store_id | integer | false | public.stores | |||
| caller_type | varchar(20) | 'user'::character varying | false | |||
| caller_id | varchar(50) | true | ||||
| bill_id | uuid | false | public.bills | |||
| payment_id | uuid | true | public.payments | |||
| operation_type | varchar(20) | false | ||||
| operation_action | varchar(50) | false | ||||
| metadata | jsonb | '{}'::jsonb | true | |||
| created_at | timestamp with time zone | now() | false |
Viewpoints
| Name | Definition |
|---|---|
| Order & Billing | Order lifecycle — Orders → Bills → Payments → Settlements |
Constraints
| Name | Type | Definition |
|---|---|---|
| bill_operation_histories_caller_type_check | CHECK | CHECK (((caller_type)::text = ANY ((ARRAY['device'::character varying, 'user'::character varying])::text[]))) |
| bill_operation_histories_operation_type_check | CHECK | CHECK (((operation_type)::text = ANY ((ARRAY['bill'::character varying, 'payment'::character varying])::text[]))) |
| bill_operation_histories_merchant_id_fkey | FOREIGN KEY | FOREIGN KEY (merchant_id) REFERENCES merchants(id) ON DELETE RESTRICT |
| bill_operation_histories_store_id_fkey | FOREIGN KEY | FOREIGN KEY (store_id) REFERENCES stores(id) ON DELETE RESTRICT |
| bill_operation_histories_bill_id_fkey | FOREIGN KEY | FOREIGN KEY (bill_id) REFERENCES bills(id) ON DELETE CASCADE |
| bill_operation_histories_payment_id_fkey | FOREIGN KEY | FOREIGN KEY (payment_id) REFERENCES payments(id) ON DELETE SET NULL |
| bill_operation_histories_pkey | PRIMARY KEY | PRIMARY KEY (id) |
Indexes
| Name | Definition |
|---|---|
| bill_operation_histories_pkey | CREATE UNIQUE INDEX bill_operation_histories_pkey ON public.bill_operation_histories USING btree (id) |
| idx_boh_bill_created | CREATE INDEX idx_boh_bill_created ON public.bill_operation_histories USING btree (bill_id, created_at) |
Relations
Generated by tbls