Skip to content

loyalty / referral ​

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.

P4-11. Personal Referral link per (owner account, app): opaque code, ACTIVE|DISABLED, version. OWN read.

public.referral_links · 12 cột · 5 check · 1 unique · 3 index · 1 policy · 3 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
owner_account_iduuidNOT NULLFK → app_memberships
owner_appapp_codeNOT NULLFK → app_memberships
codetextNOT NULL
statustextNOT NULL
disabled_attimestamptz
disabled_byuuidFK → accounts
disabled_reasontext
correlation_idcorrelation_refNOT NULL
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL

Khoá chính: id

Trỏ ra (2):

  • disabled_by → accounts · ON DELETE RESTRICT
  • owner_account_id, owner_app → app_memberships · ON DELETE RESTRICT

Được trỏ tới (2): attribution_touches, referral_milestones

referral_milestones ​

P4-11. Referral SIGNUP (Last-Touch at sign-up) + EKYC_VERIFIED / FIRST_PAID records, once per person. No reward.

public.referral_milestones · 14 cột · 5 check · 2 unique · 4 index · 1 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
referred_account_iduuidNOT NULLFK → accounts
milestonetextNOT NULL
referral_link_iduuidNOT NULLFK → referral_links
referrer_account_iduuidNOT NULLFK → accounts
referrer_appapp_codeNOT NULL
referrer_team_iduuidFK → sale_teams
signup_touch_iduuidFK → attribution_touches
signup_milestone_iduuidFK → referral_milestones
occurred_attimestamptzNOT NULL
source_typetextNOT NULL
source_idtextNOT NULL
correlation_idcorrelation_refNOT NULL
recorded_attimestamptzNOT NULL

Khoá chính: id

Trỏ ra (6):

  • referral_link_id → referral_links · ON DELETE RESTRICT
  • referred_account_id → accounts · ON DELETE RESTRICT
  • referrer_account_id → accounts · ON DELETE RESTRICT
  • referrer_team_id → sale_teams · ON DELETE RESTRICT
  • signup_milestone_id → referral_milestones · ON DELETE RESTRICT
  • signup_touch_id → attribution_touches · ON DELETE RESTRICT

Được trỏ tới (1): referral_milestones

referral_identity_keys ​

P4-12. SHA-256 of the verified eKYC identity of a referred account: one person = one referral. SYSTEM_ONLY.

public.referral_identity_keys · 6 cột · 2 check · 1 unique · 2 index · 0 policy · 2 trigger · RLS bật

CộtKiểuKhoáMô tả
identity_hashtextNOT NULLPK
referred_account_iduuidNOT NULLFK → accounts
source_typetextNOT NULL
source_idtextNOT NULL
correlation_idcorrelation_refNOT NULL
recorded_attimestamptzNOT NULL

Khoá chính: identity_hash

Trỏ ra (1):

  • referred_account_id → accounts · ON DELETE RESTRICT

Được trỏ tới: không có

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17