Columns
| Column | Type | Size | Nulls | Auto | Default | Children | Parents | Comments | |||
|---|---|---|---|---|---|---|---|---|---|---|---|
| id | uuid | 2147483647 | gen_random_uuid() |
|
|
||||||
| promotion_definition_id | uuid | 2147483647 | null |
|
|
||||||
| practice_id | text | 2147483647 | null |
|
|
||||||
| patient_id | text | 2147483647 | √ | null |
|
|
|||||
| location_id | text | 2147483647 | √ | null |
|
|
|||||
| source_kind | text | 2147483647 | null |
|
|
||||||
| source_id | text | 2147483647 | √ | null |
|
|
|||||
| source_invoice_id | text | 2147483647 | √ | null |
|
|
|||||
| source_checkout_id | text | 2147483647 | √ | null |
|
|
|||||
| line_id | text | 2147483647 | √ | null |
|
|
|||||
| catalog_item_kind | text | 2147483647 | √ | null |
|
|
|||||
| catalog_item_id | text | 2147483647 | √ | null |
|
|
|||||
| catalog_item_name | text | 2147483647 | √ | null |
|
|
|||||
| discount_cents | int4 | 10 | null |
|
|
||||||
| quote_context_hash | text | 2147483647 | √ | null |
|
|
|||||
| promotion_snapshot | jsonb | 2147483647 | '{}'::jsonb |
|
|
||||||
| cart_context | jsonb | 2147483647 | '{}'::jsonb |
|
|
||||||
| actor_user_id | text | 2147483647 | √ | null |
|
|
|||||
| idempotency_key | text | 2147483647 | null |
|
|
||||||
| applied_at | timestamptz | 35,6 | now() |
|
|
||||||
| created_at | timestamptz | 35,6 | now() |
|
|
Indexes
| Constraint Name | Type | Sort | Column(s) |
|---|---|---|---|
| promotion_applications_pkey | Primary key | Asc | id |
| promotion_applications_idempotency_key_key | Must be unique | Asc | idempotency_key |
| promotion_applications_invoice_idx | Performance | Asc/Asc/Desc | practice_id + source_invoice_id + created_at |
| promotion_applications_patient_idx | Performance | Asc/Asc/Desc | practice_id + patient_id + created_at |
| promotion_applications_practice_source_idx | Performance | Asc/Asc/Asc/Desc | practice_id + source_kind + source_id + created_at |
Check Constraints
| Constraint Name | Constraint |
|---|---|
| promotion_applications_catalog_item_kind_check | (((catalog_item_kind IS NULL) OR (catalog_item_kind = ANY (ARRAY['product'::text, 'service'::text])))) |
| promotion_applications_discount_cents_check | ((discount_cents > 0)) |
| promotion_applications_source_kind_check | ((source_kind = ANY (ARRAY['checkout'::text, 'invoice'::text, 'payment'::text, 'manual'::text, 'system'::text]))) |



