Giao diện
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ột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
code | text | NOT NULL | ||
name | text | NOT NULL | ||
status | text | NOT NULL | ||
source_campaign_id | uuid | FK → campaigns | CV3-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_by | uuid | NOT NULL | FK → accounts | |
updated_by | uuid | NOT NULL | FK → accounts | |
created_at | timestamptz | NOT NULL | ||
updated_at | timestamptz | NOT NULL | ||
version | integer | NOT NULL | ||
tone | text | VQM-P1-01 BR-VQ-07. Tông màu in force: ORANGE (Cam) | CHERRY_PINK (Hồng cherry); null on a legacy wheel. | ||
rules_text | text | VQM-P1-01 BR-VQ-10. Thể lệ (NFC, 1..2000 code points, line breaks kept); null on a legacy wheel. | ||
ever_chosen_at | timestamptz | VQM-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. | ||
legacy | boolean | NOT NULL | VQM-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 RESTRICTsource_campaign_id→campaigns·ON DELETE SET NULLupdated_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ột | Kiểu | Khoá | Mô tả | |
|---|---|---|---|---|
id | uuid | NOT NULL | PK | |
wheel_id | uuid | NOT NULL | FK → wheels | |
at | timestamptz | NOT NULL | ||
actor_id | uuid | NOT NULL | FK → accounts | |
kind | text | NOT NULL | ||
changes | jsonb | NOT NULL |
Khoá chính: id
Trỏ ra (2):
actor_id→accounts·ON DELETE RESTRICTwheel_id→wheels·ON DELETE RESTRICT
Được trỏ tới: không có