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
- Belongs to players via
player_id - Optionally references vip_levels via
vip_level_id - Optionally references player_sweepstakes_rewards via
reward_id - Consumes configuration from daily_login_rewards
Columns
| Column | Type | Nullable | Default | Description |
|---|---|---|---|---|
id | uuid | NO | gen_random_uuid() | Primary key |
player_id | uuid | NO | FK to players. The player who claimed the reward. | |
login_date | date | NO | The date this reward was claimed for. Unique per player per day. | |
day_number | integer | NO | The consecutive login day number from daily_login_rewards config used for this reward | |
gc_reward | numeric(18) | NO | 0 | Final GC reward granted (after VIP multiplier) |
sc_reward | numeric(18) | NO | Final SC reward granted (after VIP multiplier) | |
base_gc_reward | numeric(18) | YES | Base GC reward before VIP multiplier | |
base_sc_reward | numeric(18) | YES | Base SC reward before VIP multiplier | |
vip_level_id | integer | YES | FK to vip_levels. VIP level at time of claim. | |
vip_multiplier | numeric(5) | YES | VIP daily_bonus_multiplier applied from vip_levels | |
reward_id | uuid | YES | FK to player_sweepstakes_rewards. Links to the corresponding sweepstakes reward entry. | |
claimed_at | timestamp | NO | CURRENT_TIMESTAMP | When the reward was claimed |
created_at | timestamp | NO | CURRENT_TIMESTAMP | Record creation timestamp |
Key Indexes
| Index | Columns | Notes |
|---|---|---|
daily_reward_logs_pkey | id | Primary key |
idx_daily_reward_logs_player_date_unique | player_id, login_date | Unique — prevents claiming twice on the same day |
idx_daily_reward_logs_player_id | player_id | Player's reward history |
idx_daily_reward_logs_player_date | player_id, login_date | Date-based lookup per player |
idx_daily_reward_logs_player_claimed_at | player_id, claimed_at DESC | Most recent claims per player |
idx_daily_reward_logs_player_date_claimed | player_id, login_date, claimed_at | Composite for claim verification |
idx_daily_reward_logs_login_date | login_date | Date-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:
- Check player's
consecutive_login_daysfrom players - Look up the reward config from daily_login_rewards for that
day_number - Apply VIP multiplier from vip_levels.
daily_bonus_multiplier - Create this log entry with both base and final amounts
- Create a
daily_loginentry in player_sweepstakes_rewards - Credit the player's balances via transactions
- Check player's
- The
reward_idlinks 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