Skip to content

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ộtKiểuKhoáMô tả
iduuidNOT NULLPK
content_typetextNOT NULL
article_iduuidFK → cms_articles
banner_iduuidFK → cms_banners
versionintegerNOT NULL
localetextNOT NULL
titletextNOT NULL
excerpttext
body_jsonjsonb
body_htmltext
category_iduuidFK → cms_categories
cover_media_iduuidFK → media
keyword_idsuuid[]NOT NULL
seo_titletext
seo_descriptiontext
alt_texttext
image_media_iduuidFK → media
apptext
placementtext
target_kindtext
target_campaign_iduuidFK → campaigns
target_product_iduuidFK → products
target_article_iduuidFK → cms_articles
target_urltext
sort_orderinteger
starts_attimestamptz
ends_attimestamptz
created_byuuidNOT NULLFK → accounts
created_attimestamptzNOT NULL
page_iduuidFK → cms_pages
seo_canonical_urltext
seo_share_media_iduuidFK → media
seo_indexableboolean
target_page_iduuidFK → cms_pages
target_screentext
content_iduuidNOT NULL

Khoá chính: id

Trỏ ra (12):

  • article_id → cms_articles · ON DELETE RESTRICT
  • banner_id → cms_banners · ON DELETE RESTRICT
  • category_id → cms_categories · ON DELETE RESTRICT
  • cover_media_id → media · ON DELETE RESTRICT
  • created_by → accounts · ON DELETE RESTRICT
  • image_media_id → media · ON DELETE RESTRICT
  • page_id → cms_pages · ON DELETE RESTRICT
  • seo_share_media_id → media · ON DELETE RESTRICT
  • target_article_id → cms_articles · ON DELETE RESTRICT
  • target_campaign_id → campaigns · ON DELETE RESTRICT
  • target_page_id → cms_pages · ON DELETE RESTRICT
  • target_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ộtKiểuKhoáMô tả
iduuidNOT NULLPK
recipient_account_iduuidNOT NULLFK → accounts
recipient_appapp_codeNOT NULL
kindtextNOT NULL
order_iduuidFK → orders
campaign_iduuidFK → campaigns
source_event_iduuidNOT NULL
source_event_typetextNOT NULL
correlation_idcorrelation_refNOT NULL
created_attimestamptzNOT NULL
read_attimestamptz
payloadjsonbU19-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_iduuidU19-P2-16. The aggregate the notice is about (the refund case), with ref_version.
ref_versioninteger

Khoá chính: id

Trỏ ra (3):

  • campaign_id → campaigns · ON DELETE RESTRICT
  • order_id → orders · ON DELETE RESTRICT
  • recipient_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ộtKiểuKhoáMô tả
iduuidNOT NULLPK
source_event_iduuidNOT NULL
source_event_typetextNOT NULL
channeltextNOT NULL
statustextNOT NULL
reasontext
in_app_event_iduuidFK → in_app_events
correlation_idcorrelation_refNOT NULL
recorded_attimestamptzNOT 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ó

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17