Public rank change log: sa_rank_log, written on rank changes, listed on the Staff page

This commit is contained in:
Astra 2026-09-29 16:56:37 +01:00
parent 861692c534
commit 611b79cdba
11 changed files with 346 additions and 17 deletions

27
sql/rank-log.sql Normal file
View file

@ -0,0 +1,27 @@
-- Rank history: one row each time a player's rank (their highest-immunity SimpleAdmin group)
-- changes, for the public promotions/demotions list.
--
-- The panel creates this table itself at startup (it's embedded in the binary), so running it by
-- hand is only needed if the panel's database user can't CREATE TABLE. Written by the panel for
-- changes made there, and by our SimpleAdmin fork (1.8.2b-zio10+) for css_addadmin/css_deladmin
-- and the in-game admin menu. Nothing writes it for ranks that lapse when an admin's `ends` passes.
--
-- kind is added, removed, promoted, demoted (compared by group immunity) or changed (same
-- immunity). old_rank/new_rank are group names ("#rank/mod"), NULL for no rank. admin_steamid 0
-- is Console. created is a wall-clock value in SimpleAdmin's Timezone, like its other tables.
CREATE TABLE IF NOT EXISTS `sa_rank_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_steamid` bigint(20) NOT NULL,
`player_name` varchar(128) NOT NULL DEFAULT '',
`old_rank` varchar(64) NULL,
`new_rank` varchar(64) NULL,
`kind` varchar(16) NOT NULL,
`admin_steamid` bigint(20) NOT NULL DEFAULT 0,
`admin_name` varchar(128) NOT NULL DEFAULT '',
`source` varchar(16) NOT NULL,
`created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `idx_rank_log_created` (`created`),
KEY `idx_rank_log_player` (`player_steamid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;