Giao diện
content_report / 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 content_report.
content_versions
P4-17. Immutable CMS content snapshots (article/banner version n). Append-only; published = pointer.
public.content_versions · 36 cột · 20 check · 4 unique · 8 index · 2 policy · 5 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
content_type | text | NOT NULL | ||
article_id | uuid | FK → cms_articles | ||
banner_id | uuid | FK → cms_banners | ||
version | integer | NOT NULL | ||
locale | text | NOT NULL | ||
title | text | NOT NULL | ||
excerpt | text | |||
body_json | jsonb | |||
body_html | text | |||
category_id | uuid | FK → cms_categories | ||
cover_media_id | uuid | FK → media | ||
keyword_ids | uuid[] | NOT NULL | ||
seo_title | text | |||
seo_description | text | |||
alt_text | text | |||
image_media_id | uuid | FK → media | ||
app | text | |||
placement | text | |||
target_kind | text | |||
target_campaign_id | uuid | FK → campaigns | ||
target_product_id | uuid | FK → products | ||
target_article_id | uuid | FK → cms_articles | ||
target_url | text | |||
sort_order | integer | |||
starts_at | timestamptz | |||
ends_at | timestamptz | |||
created_by | uuid | NOT NULL | FK → accounts | |
created_at | timestamptz | NOT NULL | ||
page_id | uuid | FK → cms_pages | ||
seo_canonical_url | text | |||
seo_share_media_id | uuid | FK → media | ||
seo_indexable | boolean | |||
target_page_id | uuid | FK → cms_pages | ||
target_screen | text | |||
content_id | uuid | NOT NULL |
Khoá chính: id
Trỏ ra (12):
article_id→cms_articles·ON DELETE RESTRICTbanner_id→cms_banners·ON DELETE RESTRICTcategory_id→cms_categories·ON DELETE RESTRICTcover_media_id→media·ON DELETE RESTRICTcreated_by→accounts·ON DELETE RESTRICTimage_media_id→media·ON DELETE RESTRICTpage_id→cms_pages·ON DELETE RESTRICTseo_share_media_id→media·ON DELETE RESTRICTtarget_article_id→cms_articles·ON DELETE RESTRICTtarget_campaign_id→campaigns·ON DELETE RESTRICTtarget_page_id→cms_pages·ON DELETE RESTRICTtarget_product_id→products·ON DELETE RESTRICT
Được trỏ tới (3): cms_articles, cms_banners, cms_pages
in_app_events
P4-19. Minimal in-app notification: recipient + kind + order/campaign reference, created_at, read_at (set once). No text, no PII, no amount. RECIPIENT_ONLY RLS. Nothing is sent externally (G-NOT).
public.in_app_events · 14 cột · 15 check · 1 unique · 9 index · 2 policy · 4 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
recipient_account_id | uuid | NOT NULL | FK → accounts | |
recipient_app | app_code | NOT NULL | ||
kind | text | NOT NULL | ||
order_id | uuid | FK → orders | ||
campaign_id | uuid | FK → campaigns | ||
source_event_id | uuid | NOT NULL | ||
source_event_type | text | NOT NULL | ||
correlation_id | correlation_ref | NOT NULL | ||
created_at | timestamptz | NOT NULL | ||
read_at | timestamptz | |||
payload | jsonb | U19-P2-15/16, G2I-P1-03. Masked snapshot shown by the app, per kind: REFUND_COMPLETED / REFUND_PARTIALLY_COMPLETED { orderCode, amountVnd, transferredOn, accountMasked (****1234 or null), pointsRefunded }; REFUND_INFO_UPDATE_REQUESTED { orderCode, reasonCode, customerNote (only when marked for the customer) } ({ orderCode, reason, customerNote } before G2I-P1-03); ORDER_OUTCOME_CONFIRMED / ORDER_OUTCOME_PARTIAL { orderCode, remainingVnd }; none for the other kinds. | ||
ref_id | uuid | U19-P2-16. The aggregate the notice is about (the refund case), with ref_version. | ||
ref_version | integer |
Khoá chính: id
Trỏ ra (3):
campaign_id→campaigns·ON DELETE RESTRICTorder_id→orders·ON DELETE RESTRICTrecipient_account_id→accounts·ON DELETE RESTRICT
Được trỏ tới (1): notification_outbox
notification_outbox
P4-19. Per-event ledger of the in-app consumer: CREATED (with the in_app_events row) or SKIPPED with a recorded reason. Append-only; there is no sent/delivered state (G-NOT: no external channel exists).
public.notification_outbox · 9 cột · 4 check · 1 unique · 2 index · 0 policy · 2 trigger · RLS bật
| Cột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
source_event_id | uuid | NOT NULL | ||
source_event_type | text | NOT NULL | ||
channel | text | NOT NULL | ||
status | text | NOT NULL | ||
reason | text | |||
in_app_event_id | uuid | FK → in_app_events | ||
correlation_id | correlation_ref | NOT NULL | ||
recorded_at | timestamptz | NOT NULL |
Khoá chính: id
Trỏ ra (1):
in_app_event_id→in_app_events·ON DELETE RESTRICT
Được trỏ tới: không có