Skip to main content

Daily Reward Logs

Audit log recording every daily login reward claimed by a player. Stores the exact reward amounts (including VIP multipliers) for historical accuracy.

Table Comment

Audit log of daily login rewards given to players

Relationships

Columns

ColumnTypeNullableDefaultDescription
iduuidNOgen_random_uuid()Primary key
player_iduuidNOFK to players. The player who claimed the reward.
login_datedateNOThe date this reward was claimed for. Unique per player per day.
day_numberintegerNOThe consecutive login day number from daily_login_rewards config used for this reward
gc_rewardnumeric(18)NO0Final GC reward granted (after VIP multiplier)
sc_rewardnumeric(18)NOFinal SC reward granted (after VIP multiplier)
base_gc_rewardnumeric(18)YESBase GC reward before VIP multiplier
base_sc_rewardnumeric(18)YESBase SC reward before VIP multiplier
vip_level_idintegerYESFK to vip_levels. VIP level at time of claim.
vip_multipliernumeric(5)YESVIP daily_bonus_multiplier applied from vip_levels
reward_iduuidYESFK to player_sweepstakes_rewards. Links to the corresponding sweepstakes reward entry.
claimed_attimestampNOCURRENT_TIMESTAMPWhen the reward was claimed
created_attimestampNOCURRENT_TIMESTAMPRecord creation timestamp

Key Indexes

IndexColumnsNotes
daily_reward_logs_pkeyidPrimary key
idx_daily_reward_logs_player_date_uniqueplayer_id, login_dateUnique — prevents claiming twice on the same day
idx_daily_reward_logs_player_idplayer_idPlayer's reward history
idx_daily_reward_logs_player_dateplayer_id, login_dateDate-based lookup per player
idx_daily_reward_logs_player_claimed_atplayer_id, claimed_at DESCMost recent claims per player
idx_daily_reward_logs_player_date_claimedplayer_id, login_date, claimed_atComposite for claim verification
idx_daily_reward_logs_login_datelogin_dateDate-based reporting

Business Rules

  • A unique index on (player_id, login_date) prevents a player from claiming more than one daily reward per day
  • The claim flow:
    1. Check player's consecutive_login_days from players
    2. Look up the reward config from daily_login_rewards for that day_number
    3. Apply VIP multiplier from vip_levels.daily_bonus_multiplier
    4. Create this log entry with both base and final amounts
    5. Create a daily_login entry in player_sweepstakes_rewards
    6. Credit the player's balances via transactions
  • The reward_id links back to player_sweepstakes_rewards for a unified view of all player rewards
  • VIP multiplier details are snapshotted for historical accuracy — if VIP levels change later, the log retains what was actually applied