Skip to main content

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

Columns

ColumnTypeNullableDefaultDescription
player_iduuidNOPK and FK to players. One-to-one relationship.
current_vip_level_idintegerYESFK to vip_levels. The player's current VIP tier.
vip_pointsnumeric(18)YES0Total VIP points accumulated. Formula: 1 SC wagered = 1 point, 100,000 GC wagered = 1 point.
total_wageringnumeric(18)NO0Total amount wagered across all currencies (historical)
total_bonuses_claimednumeric(18)YES0Total bonuses claimed by the player
last_birthday_gift_claimed_yearintegerYESYear of last birthday gift claim (prevents multiple claims per year, e.g., 2025)
current_level_acquired_attimestamptzYESCURRENT_TIMESTAMPWhen the player reached their current VIP level. Used for the 60-day progression rule.
points_updated_attimestampYESCURRENT_TIMESTAMPTimestamp of last VIP points update
created_attimestampYESCURRENT_TIMESTAMPRecord creation timestamp
updated_attimestampYESCURRENT_TIMESTAMPLast update timestamp

Key Indexes

IndexColumnsNotes
user_vip_status_pkeyplayer_idPrimary key (also the FK to players)
idx_user_vip_status_pointsvip_pointsPoints-based queries and leaderboards
idx_user_vip_status_birthdayplayer_id, last_birthday_gift_claimed_yearBirthday gift eligibility check

VIP Points Formula

CurrencyConversion
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_level trigger on transactions when a completed bet is recorded
  • The current_level_acquired_at field 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_points crosses a vip_levels threshold, the system automatically:
    1. Updates current_vip_level_id
    2. Sets current_level_acquired_at to now
    3. Creates an entry in user_vip_status_log
    4. Creates a vip_tier_up reward in player_sweepstakes_rewards