Skip to content

order_fulfillment / stock ​

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 đè.

2 bảng. Quay lại order_fulfillment.

stock_shortage_cases ​

P2-19. Ops shortage decision (A-OD-07, interim AS-02): source Campaign Product (+ cycle), reason, private evidence, the affected whole Orders (child rows). Born CONFIRMED with the cancellations; immutable.

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

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
case_typetextNOT NULL
statustextNOT NULL
campaign_iduuidNOT NULLFK → campaign_products
campaign_product_iduuidNOT NULLFK → campaign_products
cycle_nointeger
reasontextNOT NULL
evidence_media_idsuuid[]NOT NULL
policy_reftextNOT NULL
order_countintegerNOT NULL
recorded_byuuidNOT NULLFK → accounts
source_event_idtextNOT NULL
recorded_attimestamptzNOT NULL
versionintegerNOT NULL

Khoá chính: id

Trỏ ra (3):

  • campaign_id → campaigns · ON DELETE RESTRICT
  • campaign_product_id, campaign_id → campaign_products · ON DELETE RESTRICT
  • recorded_by → accounts · ON DELETE RESTRICT

Được trỏ tới (4): payment_remaining_recalcs, point_reward_partial_cancels, refund_cases, stock_shortage_case_orders

stock_shortage_case_orders ​

P2-19. Whole affected Order of a shortage case: missing quantity, delivered/undelivered evidence, refund snapshot (FULL_ORDER, P3 executes), applied interim rules, LOCKED -> CANCELLED version step. Immutable.

public.stock_shortage_case_orders · 27 cột · 7 check · 1 unique · 5 index · 2 policy · 4 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
case_iduuidNOT NULLFK → stock_shortage_cases
order_iduuidNOT NULLFK → orders
owner_account_iduuidNOT NULLFK → accounts
campaign_typetextNOT NULL
policy_version_iduuidNOT NULLFK → campaign_policy_versions
missing_quantityintegerNOT NULL
line_quantityintegerNOT NULL
ordered_unitsbigintNOT NULL
committed_cyclesintegerNOT NULL
delivered_cyclesintegerNOT NULL
undelivered_unitsbigintNOT NULL
deposit_vndbigintNOT NULL
points_usedintegerNOT NULL
points_value_vndbigintNOT NULL
applied_rulestext[]NOT NULL
from_versionintegerNOT NULL
to_versionintegerNOT NULL
refund_scopetextNOT NULL
recorded_attimestamptzNOT NULL
outcometextNOT NULLFU-575. WHOLE_ORDER (AS-01/AS-02: nothing remains, or Recurring) or PARTIAL_UNITS (DEC-CP-SHORTAGE: the Order stays LOCKED).
cancelled_beforeintegerNOT NULL
remaining_afterintegerNOT NULL
refund_cash_vndbigintNOT NULLFU-575. Deposit share to refund for this row, server-computed (cumulative rounding, deposit kept rounded up).
refund_pointsintegerNOT NULLFU-575. Points share to reverse for this row, server-computed (cumulative floor).
remaining_obligationtextNOT NULLFU-575. REMAINING payment obligation of the Order when recorded (NONE | OPEN | SETTLED): its amount is NOT recalculated (GAP-850).
cycle_unitsjsonbFU-SHORTAGE2. Recurring only: [{cycleNo, units}] the units this row cancelled per undelivered cycle (last cycle first, PAY-BRULE-26).

Khoá chính: id

Trỏ ra (4):

  • case_id → stock_shortage_cases · ON DELETE RESTRICT
  • order_id → orders · ON DELETE RESTRICT
  • owner_account_id → accounts · ON DELETE RESTRICT
  • policy_version_id → campaign_policy_versions · ON DELETE RESTRICT

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

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17