User VIP Status
Tracks the current VIP status of each player, including their accumulated points, current level, and bonus tracking. One row per player (PK = player_id).
Relationships
- Belongs to players via
player_id(1:1) - References vip_levels via
current_vip_level_id - Logged by user_vip_status_log on level changes
- Drives vip_daily_cashback_log cashback calculations
Columns
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
player_id | uuid | NO | PK and FK to players. One-to-one relationship. | |
current_vip_level_id | integer | YES | FK to vip_levels. The player's current VIP tier. | |
vip_points | numeric(18) | YES | 0 | Total VIP points accumulated. Formula: 1 SC wagered = 1 point, 100,000 GC wagered = 1 point. |
total_wagering | numeric(18) | NO | 0 | Total amount wagered across all currencies (historical) |
total_bonuses_claimed | numeric(18) | YES | 0 | Total bonuses claimed by the player |
last_birthday_gift_claimed_year | integer | YES | Year of last birthday gift claim (prevents multiple claims per year, e.g., 2025) | |
current_level_acquired_at | timestamptz | YES | CURRENT_TIMESTAMP | When the player reached their current VIP level. Used for the 60-day progression rule. |
points_updated_at | timestamp | YES | CURRENT_TIMESTAMP | Timestamp of last VIP points update |
created_at | timestamp | YES | CURRENT_TIMESTAMP | Record creation timestamp |
updated_at | timestamp | YES | CURRENT_TIMESTAMP | Last update timestamp |
Key Indexes
| Index | Columns | Notes |
|---|---|---|
user_vip_status_pkey | player_id | Primary key (also the FK to players) |
idx_user_vip_status_points | vip_points | Points-based queries and leaderboards |
idx_user_vip_status_birthday | player_id, last_birthday_gift_claimed_year | Birthday gift eligibility check |
VIP Points Formula
| Currency | Conversion |
|---|---|
| SC (Sweepstakes Coins) | 1 SC wagered = 1 VIP point |
| GC (Gold Coins) | 100,000 GC wagered = 1 VIP point |
Business Rules
- This table is a 1:1 extension of players — the PK is
player_id - VIP points are automatically updated by the
update_vip_points_and_leveltrigger on transactions when a completed bet is recorded - The
current_level_acquired_atfield is used for the 60-day progression rule: players must maintain activity for at least 60 days at their current level before being eligible for tier-down evaluation - Birthday gifts can only be claimed once per calendar year, tracked by
last_birthday_gift_claimed_year - When
vip_pointscrosses a vip_levels threshold, the system automatically:- Updates
current_vip_level_id - Sets
current_level_acquired_atto now - Creates an entry in user_vip_status_log
- Creates a
vip_tier_upreward in player_sweepstakes_rewards
- Updates