Giao diện
loyalty / bảng đơn lẻ (3)
Trang sinh tự động
Sinh từ ad83b0aea — chạy 820 migration lên PostgreSQL 17 rồi đọc pg_catalog. Mô tả bảng và cột lấy từ COMMENT ON. Không sửa tay: lần chạy docgen sau sẽ ghi đè.
3 bảng. Quay lại loyalty.
affiliate_links
P4-11. Affiliate link per (owner, app, Campaign[/Campaign Product]) with opaque code; ACTIVE|DISABLED. OWN read.
public.affiliate_links · 14 cột · 5 check · 1 unique · 4 index · 1 policy · 3 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
owner_account_id | uuid | NOT NULL | FK → app_memberships | |
owner_app | app_code | NOT NULL | FK → app_memberships | |
code | text | NOT NULL | ||
target_campaign_id | uuid | NOT NULL | FK → campaign_products | |
target_campaign_product_id | uuid | FK → campaign_products | ||
status | text | NOT NULL | ||
disabled_at | timestamptz | |||
disabled_by | uuid | FK → accounts | ||
disabled_reason | text | |||
correlation_id | correlation_ref | NOT NULL | ||
created_at | timestamptz | NOT NULL | ||
updated_at | timestamptz | NOT NULL | ||
version | integer | NOT NULL |
Khoá chính: id
Trỏ ra (4):
disabled_by→accounts·ON DELETE RESTRICTowner_account_id, owner_app→app_memberships·ON DELETE RESTRICTtarget_campaign_id→campaigns·ON DELETE RESTRICTtarget_campaign_product_id, target_campaign_id→campaign_products·ON DELETE RESTRICT
Được trỏ tới (2): attribution_assignments, attribution_touches
member_tier_history
U28-P3-01. APPEND_ONLY_RETAIN customer Tier history of the new model: head = current Tier (occurred_at = reachedAt); from/to names are snapshots at record time (rename/delete never rewrites them).
public.member_tier_history · 19 cột · 9 check · 1 unique · 7 index · 2 policy · 3 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
account_id | uuid | NOT NULL | FK → member_tier_history | |
audience | text | NOT NULL | FK → tier_definitions | |
previous_id | uuid | FK → member_tier_history | ||
occurred_at | timestamptz | NOT NULL | ||
reason | text | NOT NULL | ||
source | text | NOT NULL | ||
from_definition_id | uuid | FK → tier_definitions | ||
from_name | text | |||
to_definition_id | uuid | NOT NULL | FK → tier_definitions | |
to_name | text | NOT NULL | ||
set_version_id | uuid | NOT NULL | FK → tier_set_versions | |
effective_rank | bigint | NOT NULL | ||
source_points | bigint | |||
source_ref | text | |||
source_id | uuid | |||
reevaluation_id | uuid | FK → tier_reevaluations | ||
correlation_id | correlation_ref | NOT NULL | ||
created_at | timestamptz | NOT NULL |
Khoá chính: id
Trỏ ra (6):
account_id→accounts·ON DELETE RESTRICTfrom_definition_id, audience→tier_definitions·ON DELETE RESTRICTprevious_id, account_id→member_tier_history·ON DELETE RESTRICTreevaluation_id→tier_reevaluations·ON DELETE RESTRICTset_version_id→tier_set_versions·ON DELETE RESTRICTto_definition_id, audience→tier_definitions·ON DELETE RESTRICT
Được trỏ tới (1): member_tier_history
sale_role_transfers
FU-866. One User -> Sale Tier transfer per USER_REQUEST application (SA-12, A-TIER-05): status, what was carried (valid rank only, lots keep their expiry) and acknowledged_at = the person saw the result (GAP-865). Written only by tier.perform_sale_transfer / tier.sale_transition_acknowledge; never deleted.
public.sale_role_transfers · 18 cột · 7 check · 1 unique · 2 index · 0 policy · 5 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
application_id | uuid | NOT NULL | FK → sale_applications | |
account_id | uuid | NOT NULL | FK → accounts | |
status | text | NOT NULL | ||
attempts | integer | NOT NULL | ||
failure_code | text | |||
from_tier_version_id | uuid | FK → tier_versions | ||
to_tier_version_id | uuid | FK → tier_versions | ||
assignment_id | uuid | FK → tier_assignments | ||
evaluation_id | uuid | FK → tier_evaluations | ||
carried_rank | bigint | |||
carried_lots | integer | |||
completed_at | timestamptz | |||
acknowledged_at | timestamptz | |||
correlation_id | correlation_ref | NOT NULL | ||
created_at | timestamptz | NOT NULL | ||
updated_at | timestamptz | NOT NULL | ||
version | integer | NOT NULL |
Khoá chính: id
Trỏ ra (6):
account_id→accounts·ON DELETE RESTRICTapplication_id→sale_applications·ON DELETE RESTRICTassignment_id→tier_assignments·ON DELETE RESTRICTevaluation_id→tier_evaluations·ON DELETE RESTRICTfrom_tier_version_id→tier_versions·ON DELETE RESTRICTto_tier_version_id→tier_versions·ON DELETE RESTRICT
Được trỏ tới: không có