PlaytimeHistory/Migrations/002_Events.sql

30 lines
1.2 KiB
SQL

-- One row per kill, bomb plant and bomb defuse, written as it happens (0.2.0+). Nothing during
-- warmup. Kills leave out suicides and team kills.
-- kind: 1 kill, 2 bomb planted, 3 bomb defused. steamid64 is who did it: the killer, planter or
-- defuser. The kill-only columns are NULL for plants and defuses, and site is NULL for kills.
-- victim_steamid64 is NULL when the victim was a bot (victim_bot 1).
CREATE TABLE IF NOT EXISTS `pt_events` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`event_key` char(32) NOT NULL,
`server_id` int NOT NULL,
`session_key` char(32) NULL,
`steamid64` bigint unsigned NOT NULL,
`kind` tinyint NOT NULL,
`at` datetime NOT NULL,
`map` varchar(64) NOT NULL,
`team` tinyint NOT NULL,
`weapon` varchar(64) NULL,
`headshot` tinyint NULL,
`noscope` tinyint NULL,
`thrusmoke` tinyint NULL,
`wallbang` tinyint NULL,
`blind` tinyint NULL,
`victim_steamid64` bigint unsigned NULL,
`victim_bot` tinyint NULL,
`site` int NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_event_key` (`event_key`),
KEY `ix_kind_at` (`kind`, `at`),
KEY `ix_steamid_at` (`steamid64`, `at`),
KEY `ix_at` (`at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;