-
Notifications
You must be signed in to change notification settings - Fork 0
Database Structure
Primary player information is stored in a single table called players
. Players are stored by their account ID (generated by WG), with account name, creation date, last battle date, total battle count, last API update, console, and last date queried by this project. All but the last two items are provided by WG's API.
The diff_battles
and total_battles
tables act as snapshots in time. When a player's total battle count is changed, it is compared to the existing value. The difference is placed in the first table and their new total is placed in the second. This allows us to graph how much they play over time, as well as compare their total to others in a similar time series.
When a query returns results from WG's API, it is split into different players and pushed to the database. If the player didn't exist in the database before, they're inserted into the players
table and their total is inserted into the total_battles
table. No further processing is done. If the player already existed, nothing happens unless their total battle count is changed. If it is, the process of the previous paragraph is followed.
WG may change the last_battle_time
or updated_at
values at any time. These changes are pushed to the database, but are not put into a snapshot. The created_at
value is not pushed in an UPDATE
command anywhere. So some data could possibly be altered at will by WG if they desired and this project will not note it. This is outside the scope of the project's intended purpose of tracking, but due diligence should be had just in case.