split stats and sessions

This commit is contained in:
2018-10-12 21:49:10 +02:00
parent 78597f6a91
commit 1204423f2c
18 changed files with 354 additions and 42 deletions

12
Auth/resources/create.sql Normal file
View File

@ -0,0 +1,12 @@
CREATE TABLE IF NOT EXISTS `{prefix}sessions` (
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT,
`server` bigint UNSIGNED NOT NULL,
`uuid` binary(16) NOT NULL,
`serverNick` varchar(32) NOT NULL,
`ip` int UNSIGNED NOT NULL,
`date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
`playtime` mediumint UNSIGNED DEFAULT 0,
`server`
PRIMARY KEY `id` (`id`),
UNIQUE KEY `date_player` (`uuid`, `date`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

View File

@ -0,0 +1,7 @@
INSERT INTO `{prefix}sessions`
(`uuid`, `server`, `serverNick`, `ip`, `date`, `playtime`) VALUES
(?, ?, ?, ?, ?, ?, ?, ?)
ON DUPLICATE KEY
UPDATE
`playtime` = `playtime` + VALUES(`playtime`),
`date` = VALUES(`date`);