Skip to content

spin / wheel ​

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 spin.

wheels ​

CV3-P1-07 + VQM-P1-01. A lucky wheel: its rule versions (spin_rule_versions.wheel_id) are shared by every campaign that chose it (campaigns.spin_wheel_id). Code VQ + ddmmyyyy + 2 digits per day (DEC-VQM-11; legacy wheels keep 4). Deleted only by spin.delete_wheel, while never chosen and not legacy (BR-VQ-05).

spin.wheels · 14 cột · 6 check · 2 unique · 4 index · 3 policy · 4 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
codetextNOT NULL
nametextNOT NULL
statustextNOT NULL
source_campaign_iduuidFK → campaignsCV3-P1-07. The campaign this wheel was made for (DEC-CV3-06 backfill or the deprecated campaignId path, S4); null for a wheel created in Thiết lập trò chơi. Not a choice: campaigns.spin_wheel_id is.
created_byuuidNOT NULLFK → accounts
updated_byuuidNOT NULLFK → accounts
created_attimestamptzNOT NULL
updated_attimestamptzNOT NULL
versionintegerNOT NULL
tonetextVQM-P1-01 BR-VQ-07. Tông màu in force: ORANGE (Cam) | CHERRY_PINK (Hồng cherry); null on a legacy wheel.
rules_texttextVQM-P1-01 BR-VQ-10. Thể lệ (NFC, 1..2000 code points, line breaks kept); null on a legacy wheel.
ever_chosen_attimestamptzVQM-P1-01 BR-VQ-05. First time a campaign chose the wheel (any state, DRAFT included; campaigns_spin_wheel_choice); never cleared. Backfill DEC-VQM-17 (3). Not null = cannot be deleted.
legacybooleanNOT NULLVQM-P1-01 DEC-VQM-14. True for every wheel created before this migration (CV3 / backfill test data): view only, no new choice, never deleted by spin.delete_wheel (VQM-P1-03 operator script). False for every later wheel.

Khoá chính: id

Trỏ ra (3):

  • created_by → accounts · ON DELETE RESTRICT
  • source_campaign_id → campaigns · ON DELETE SET NULL
  • updated_by → accounts · ON DELETE RESTRICT

Được trỏ tới (4): campaigns, spin_rule_versions, spin_sessions, wheel_change_events

wheel_change_events ​

VQM-P1-05 BR-VQ-12, DEC-VQM-20. Lịch sử thay đổi of a lucky wheel, append-only: CREATED (Tạo, also a copy), UPDATED (Sửa that changed something; changes = [{scope, scope_no, field, before, after}] by position), DEACTIVATED (Ngừng hoạt động). Written only by spin.record_wheel_change; read through spin.wheel_history_page.

spin.wheel_change_events · 6 cột · 2 check · 0 unique · 2 index · 0 policy · 3 trigger · RLS bật

CộtKiểuKhoáMô tả
iduuidNOT NULLPK
wheel_iduuidNOT NULLFK → wheels
attimestamptzNOT NULL
actor_iduuidNOT NULLFK → accounts
kindtextNOT NULL
changesjsonbNOT NULL

Khoá chính: id

Trỏ ra (2):

  • actor_id → accounts · ON DELETE RESTRICT
  • wheel_id → wheels · ON DELETE RESTRICT

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

Sinh từ ad83b0aea · 820 migration · PostgreSQL 17