Giao diện
campaign / bảng đơn lẻ (5)
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 đè.
5 bảng. Quay lại campaign.
deal_terms_sets
U19-P1-03. Deal participation terms sets (Word B058.R10). Stub source: operator SQL only, no API write. RLS: deal.read / deal.manage holders read (campaign.actor_can_manage()).
public.deal_terms_sets · 9 cột · 5 check · 1 unique · 3 index · 1 policy · 2 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
name | text | NOT NULL | ||
version | text | NOT NULL | ||
content | text | NOT NULL | ||
status | text | NOT NULL | ||
created_by | uuid | FK → accounts | ||
created_at | timestamptz | NOT NULL | ||
updated_at | timestamptz | NOT NULL | ||
version_no | integer | NOT NULL |
Khoá chính: id
Trỏ ra (1):
created_by→accounts·ON DELETE RESTRICT
Được trỏ tới (2): campaigns, orders
delivery_milestones
P2-06. Group Buy delivery milestones (date range + reward points bp), locked once the campaign leaves DRAFT.
public.delivery_milestones · 15 cột · 7 check · 1 unique · 2 index · 4 policy · 3 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
campaign_id | uuid | NOT NULL | FK → campaigns | |
campaign_type | text | NOT NULL | FK → campaigns | |
milestone_no | integer | NOT NULL | ||
delivers_from | date | U19-P1-04. Giao từ ngày (B064.R04), a Vietnam calendar date. | ||
delivers_to | date | U19-P1-04. Đến ngày (B064.R04), a Vietnam calendar date >= delivers_from. | ||
reward_point_bp | integer | |||
created_by | uuid | NOT NULL | FK → accounts | |
updated_by | uuid | NOT NULL | FK → accounts | |
created_at | timestamptz | NOT NULL | ||
updated_at | timestamptz | NOT NULL | ||
name | text | U19-P1-04. Tên hiển thị trên App (B064.R02), <= 100; required outside DRAFT (campaign.assert_ready). | ||
label | text | U19-P1-04. Nhãn hiển thị trên App (B064.R03), <= 50; NULL = no label. | ||
reward_value | integer | U19-P1-04. Pi-Point thưởng (B064.R05) in campaigns.reward_unit (bp or points); replaces reward_point_bp. | ||
legacy_unvalidated | boolean | NOT NULL | U19-P1-06 GAP-W-CD-11. A pre-U19 milestone numbered above 5; exempted from delivery_milestones_no_max. |
Khoá chính: id
Trỏ ra (3):
campaign_id, campaign_type→campaigns·ON DELETE CASCADEcreated_by→accounts·ON DELETE RESTRICTupdated_by→accounts·ON DELETE RESTRICT
Được trỏ tới (2): orders, shipments
daily_code_counters
PAF-P1-17 BR-C-13 (Product 02/11). Shared per-day code counter: the last number issued per (scope, Vietnam day). Written only by campaign.next_daily_code(); a number never goes down and rows are never deleted. Scopes: campaign (CD, campaigns.code); excess_deposit (DU, PAF-P1-18).
public.daily_code_counters · 4 cột · 2 check · 0 unique · 1 index · 0 policy · 3 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
scope | text | NOT NULL | PK | |
day | date | NOT NULL | PK | |
last_value | integer | NOT NULL | ||
updated_at | timestamptz | NOT NULL |
Khoá chính: scope, day
Trỏ ra: không có
Được trỏ tới: không có
price_tiers
P2-06. Tier table per campaign product and policy version: integer VND, non-overlapping ranges, contiguous + open-ended last tier checked at review; immutable once its policy version is frozen.
public.price_tiers · 10 cột · 3 check · 0 unique · 2 index · 3 policy · 2 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
campaign_id | uuid | NOT NULL | FK → campaign_products | |
campaign_product_id | uuid | NOT NULL | FK → campaign_products | |
policy_version_id | uuid | NOT NULL | FK → campaign_policy_versions | |
min_qty | integer | |||
max_qty | integer | |||
unit_price_vnd | bigint | |||
qty_range | int4range | |||
created_by | uuid | NOT NULL | FK → accounts | |
created_at | timestamptz | NOT NULL |
Khoá chính: id
Trỏ ra (3):
created_by→accounts·ON DELETE RESTRICTpolicy_version_id, campaign_id→campaign_policy_versions·ON DELETE CASCADEcampaign_product_id, campaign_id→campaign_products·ON DELETE CASCADE
Được trỏ tới: không có
system_settings
U19-P1-03. System configuration parameters (Cấu hình hệ thống), non-secret. Read through settings.get_int / settings.get_text; operator SQL only, no API write.
public.system_settings · 4 cột · 1 check · 0 unique · 1 index · 1 policy · 1 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
key | text | NOT NULL | PK | |
value | jsonb | NOT NULL | ||
updated_by | uuid | FK → accounts | ||
updated_at | timestamptz | NOT NULL |
Khoá chính: key
Trỏ ra (1):
updated_by→accounts·ON DELETE RESTRICT
Được trỏ tới: không có