X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=README.md;h=c18762f6c61d32bb366d36c11a5ef0b70e99fa16;hb=9da849fd765f5ea4578d81bde1467b32afa684a7;hp=4d17435a4aedf9af89f4a9f92df0d642d5efd744;hpb=524627334668637332327a65f7a7d5584fbc0129;p=xonotic%2Fxonstatdb.git diff --git a/README.md b/README.md index 4d17435..c18762f 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,13 @@ Next, create the database itself: OWNER=xonstat CONNECTION LIMIT=-1; +If you intend to use the `drop_and_load.shl` script in the scripts folder, you may want to give +the application user superuser within the database. To do that you can use the following command: + + postgres=# alter user xonstat with superuser; + +When done, exit the psql prompt: + postgres=# \q Next, as your regular system user, log into the newly created database @@ -46,7 +53,7 @@ Create the schema in which all of the xonstat tables will reside: CREATE SCHEMA xonstat AUTHORIZATION xonstat; -Create the pgplsql language, if it doesn't exist: +Create the plpgsql language, if it doesn't exist: CREATE LANGUAGE plpgsql; @@ -58,6 +65,35 @@ Now load the initial tables: And that's it! +Do note that there are a few maintenance scripts that can be used +once the database begins accumulating data. These can be found in +the scripts subdirectory and are intended to be implemented as cron jobs. +A summary of what they do follows: + + update\_elos.sql - will decrease player elo records by one point + day for every day after 30 days of inactivity + until they hit the elo "floor" of 100. This + prevents inactive players from staying on the + leaderboard/ranks for too long. + + update\_ranks.sql - will populate the player\_ranks table each day + according to the elo values when it is run. + + refresh\_$TABLE\_mv.sql - updates the "materialized view" named by $TABLE. + + purge\_anticheat\_log.sql - deletes old anticheat data. + +There is also a "merge players" function in the functions sub- +directory. This can be used to merge two players together into one +record in the presentation layer of XonStat. It can be run as follows: + + select merge\_players(winner\_player\_id, loser\_player\_id); + +The "winner" player ID is the account that remains active after the +transaction. + +Enjoy! + [xonotic]: http://www.xonotic.org/ [xonstat]: http://stats.xonotic.org/