Game leaderboards and achievements database schema

How a game backend models progression: score submissions, leaderboards scoped global or regional or friends across daily and seasonal periods, rank derived rather than stored, multi-step achievements with progress, unlock rewards and anti-cheat flags.

Leaderboards Achievements ER diagram

Game leaderboards and achievements database schema n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 games idBIGINT codeVARCHAR nameVARCHAR default_score_dir…VARCHAR submission_secret…VARCHAR created_atTIMESTAMP players idBIGINT external_idVARCHAR game_idBIGINT display_nameVARCHAR country_codeCHAR is_bannedBOOLEAN created_atTIMESTAMP seasons idBIGINT game_idBIGINT codeVARCHAR nameVARCHAR starts_atTIMESTAMPTZ ends_atTIMESTAMPTZ is_finalisedBOOLEAN leaderboards idBIGINT game_idBIGINT season_idBIGINT codeVARCHAR nameVARCHAR scopeVARCHAR periodVARCHAR metricVARCHAR score_directionVARCHAR aggregationVARCHAR is_activeBOOLEAN score_submissions idBIGINT game_idBIGINT player_idBIGINT season_idBIGINT metricVARCHAR valueBIGINT contextJSONB idempotency_keyVARCHAR client_versionVARCHAR occurred_atTIMESTAMPTZ received_atTIMESTAMPTZ review_stateVARCHAR leaderboard_entries idBIGINT leaderboard_idBIGINT player_idBIGINT submission_idBIGINT scoreBIGINT tiebreak_atTIMESTAMPTZ updated_atTIMESTAMPTZ anti_cheat_flags idBIGINT submission_idBIGINT rule_codeVARCHAR severitySMALLINT detailJSONB verdictVARCHAR reviewed_byVARCHAR created_atTIMESTAMPTZ resolved_atTIMESTAMPTZ achievements idBIGINT game_idBIGINT codeVARCHAR nameVARCHAR descriptionVARCHAR pointsSMALLINT is_secretBOOLEAN is_incrementalBOOLEAN season_idBIGINT retired_atTIMESTAMPTZ achievement_criteria idBIGINT achievement_idBIGINT step_indexSMALLINT descriptionVARCHAR metricVARCHAR comparisonVARCHAR target_valueBIGINT requires_previousBOOLEAN achievement_progress player_idBIGINT criterion_idBIGINT current_valueBIGINT completed_atTIMESTAMPTZ updated_atTIMESTAMPTZ player_achievements idBIGINT player_idBIGINT achievement_idBIGINT unlocked_atTIMESTAMPTZ season_idBIGINT is_first_in_gameBOOLEAN achievement_rewards idBIGINT achievement_idBIGINT reward_typeVARCHAR reward_refVARCHAR quantityINTEGER reward_grants idBIGINT player_achievemen…BIGINT reward_idBIGINT reward_typeVARCHAR reward_refVARCHAR quantityINTEGER idempotency_keyVARCHAR stateVARCHAR granted_atTIMESTAMPTZ

Related database schemas