From 2bf6b97a29002e1e64361bd5e85b5224eadf4ef9 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 14 Oct 2021 16:07:09 +0200 Subject: [PATCH] [MIRROR] Make round ID nullable in bans and tickets [MDB IGNORE] (#8773) * Make round ID nullable in bans and tickets * Axes Merge Conflict. Increments SQL version (#8822) Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com> Co-authored-by: ORCACommander --- SQL/database_changelog.txt | 26 ++++++++++++++++++++++---- SQL/tgstation_schema.sql | 24 ++++++++++++------------ SQL/tgstation_schema_prefixed.sql | 22 +++++++++++----------- code/__DEFINES/subsystems.dm | 2 +- 4 files changed, 46 insertions(+), 28 deletions(-) diff --git a/SQL/database_changelog.txt b/SQL/database_changelog.txt index 6f39925d5d5..25a52b6806f 100644 --- a/SQL/database_changelog.txt +++ b/SQL/database_changelog.txt @@ -1,20 +1,38 @@ Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255. -The latest database version is 5.18 (5.16 for /tg/); The query to update the schema revision table is: +The latest database version is 5.19 (5.17 for /tg/); The query to update the schema revision table is: -INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 18); +INSERT INTO `schema_revision` (`major`, `minor`) VALUES (5, 19); or -INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 18); +INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (5, 19); In any query remember to add a prefix to the table names if you use one. ----------------------------------------------------- -Version 5.18, 23 August 2021, by GoldenAlpharex +Version 5.19, 23 August 2021, by GoldenAlpharex Added `discord_report` column to the `ban table` ``` `discord_reported` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0', /* SKYRAT EDIT - Labelling bans for ease of reporting them over Discord. */ ``` +----------------------------------------------------- +Version 5.17, 8 October 2021, by MrStonedOne + Mothblocks +Changes any table that requrired a NOT NULL round ID to now accept NULL. In the BSQL past, these were handled as 0, but in the move to rust-g this behavior was lost. + +``` +ALTER TABLE `admin_log` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `ban` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `citation` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `connection_log` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `death` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `feedback` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `legacy_population` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `library` CHANGE `round_id_created` `round_id_created` INT(11) UNSIGNED NULL; +ALTER TABLE `messages` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `player` CHANGE `firstseen_round_id` `firstseen_round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `player` CHANGE `lastseen_round_id` `lastseen_round_id` INT(11) UNSIGNED NULL; +ALTER TABLE `ticket` CHANGE `round_id` `round_id` INT(11) UNSIGNED NULL; +``` ----------------------------------------------------- Version 5.17, 31 July 2021, by Atlanta-Ned diff --git a/SQL/tgstation_schema.sql b/SQL/tgstation_schema.sql index 7bb43bc5b71..9804bff4e3a 100644 --- a/SQL/tgstation_schema.sql +++ b/SQL/tgstation_schema.sql @@ -34,7 +34,7 @@ DROP TABLE IF EXISTS `admin_log`; CREATE TABLE `admin_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `datetime` datetime NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `adminckey` varchar(32) NOT NULL, `adminip` int(10) unsigned NOT NULL, `operation` enum('add admin','remove admin','change admin rank','add rank','remove rank','change rank flags') NOT NULL, @@ -73,7 +73,7 @@ CREATE TABLE `ban` ( `server_name` VARCHAR(32) DEFAULT NULL, `server_ip` INT(10) UNSIGNED NOT NULL, `server_port` SMALLINT(5) UNSIGNED NOT NULL, - `round_id` INT(11) UNSIGNED NOT NULL, + `round_id` INT(11) UNSIGNED NULL, `role` VARCHAR(32) NULL DEFAULT NULL, `global_ban` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', `expiration_time` DATETIME NULL DEFAULT NULL, @@ -109,7 +109,7 @@ DROP TABLE IF EXISTS `citation`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE IF NOT EXISTS `citation` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `server_ip` int(11) unsigned NOT NULL, `server_port` int(11) unsigned NOT NULL, `citation` text NOT NULL, @@ -139,7 +139,7 @@ CREATE TABLE `connection_log` ( `server_name` VARCHAR(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `ckey` varchar(45) DEFAULT NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(45) DEFAULT NULL, @@ -164,7 +164,7 @@ CREATE TABLE `death` ( `server_name` varchar(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) NOT NULL, + `round_id` int(11) unsigned NULL, `tod` datetime NOT NULL COMMENT 'Time of death', `job` varchar(32) NOT NULL, `special` varchar(32) DEFAULT NULL, @@ -195,7 +195,7 @@ DROP TABLE IF EXISTS `feedback`; CREATE TABLE `feedback` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `datetime` datetime NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `key_name` varchar(32) NOT NULL, `key_type` enum('text', 'amount', 'tally', 'nested tally', 'associative') NOT NULL, `version` tinyint(3) unsigned NOT NULL, @@ -235,7 +235,7 @@ CREATE TABLE `legacy_population` ( `server_name` varchar(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -256,7 +256,7 @@ CREATE TABLE `library` ( `ckey` varchar(32) NOT NULL DEFAULT 'LEGACY', `datetime` datetime NOT NULL, `deleted` tinyint(1) unsigned DEFAULT NULL, - `round_id_created` int(11) unsigned NOT NULL, + `round_id_created` int(11) unsigned NULL, PRIMARY KEY (`id`), KEY `deleted_idx` (`deleted`), KEY `idx_lib_id_del` (`id`,`deleted`), @@ -302,7 +302,7 @@ CREATE TABLE `messages` ( `server` varchar(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `secret` tinyint(1) unsigned NOT NULL, `expire_timestamp` datetime DEFAULT NULL, `severity` enum('high','medium','minor','none') DEFAULT NULL, @@ -366,9 +366,9 @@ CREATE TABLE `player` ( `ckey` varchar(32) NOT NULL, `byond_key` varchar(32) DEFAULT NULL, `firstseen` datetime NOT NULL, - `firstseen_round_id` int(11) unsigned NOT NULL, + `firstseen_round_id` int(11) unsigned NULL, `lastseen` datetime NOT NULL, - `lastseen_round_id` int(11) unsigned NOT NULL, + `lastseen_round_id` int(11) unsigned NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(32) NOT NULL, `lastadminrank` varchar(32) NOT NULL DEFAULT 'Player', @@ -593,7 +593,7 @@ CREATE TABLE `ticket` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `ticket` smallint(11) unsigned NOT NULL, `action` varchar(20) NOT NULL DEFAULT 'Message', `message` text NOT NULL, diff --git a/SQL/tgstation_schema_prefixed.sql b/SQL/tgstation_schema_prefixed.sql index 0aa8248e95d..9623b47ca42 100644 --- a/SQL/tgstation_schema_prefixed.sql +++ b/SQL/tgstation_schema_prefixed.sql @@ -34,7 +34,7 @@ DROP TABLE IF EXISTS `SS13_admin_log`; CREATE TABLE `SS13_admin_log` ( `id` int(11) NOT NULL AUTO_INCREMENT, `datetime` datetime NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `adminckey` varchar(32) NOT NULL, `adminip` int(10) unsigned NOT NULL, `operation` enum('add admin','remove admin','change admin rank','add rank','remove rank','change rank flags') NOT NULL, @@ -73,7 +73,7 @@ CREATE TABLE `SS13_ban` ( `server_name` VARCHAR(32) DEFAULT NULL, `server_ip` INT(10) UNSIGNED NOT NULL, `server_port` SMALLINT(5) UNSIGNED NOT NULL, - `round_id` INT(11) UNSIGNED NOT NULL, + `round_id` INT(11) UNSIGNED NULL, `role` VARCHAR(32) NULL DEFAULT NULL, `global_ban` TINYINT(1) UNSIGNED NOT NULL DEFAULT '1', `expiration_time` DATETIME NULL DEFAULT NULL, @@ -108,7 +108,7 @@ DROP TABLE IF EXISTS `SS13_citation`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE IF NOT EXISTS `SS13_citation` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `server_ip` int(11) unsigned NOT NULL, `server_port` int(11) unsigned NOT NULL, `citation` text NOT NULL, @@ -163,7 +163,7 @@ CREATE TABLE `SS13_death` ( `server_name` varchar(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) NOT NULL, + `round_id` int(11) NULL, `tod` datetime NOT NULL COMMENT 'Time of death', `job` varchar(32) NOT NULL, `special` varchar(32) DEFAULT NULL, @@ -194,7 +194,7 @@ DROP TABLE IF EXISTS `SS13_feedback`; CREATE TABLE `SS13_feedback` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `datetime` datetime NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `key_name` varchar(32) NOT NULL, `version` tinyint(3) unsigned NOT NULL, `key_type` enum('text', 'amount', 'tally', 'nested tally', 'associative') NOT NULL, @@ -234,7 +234,7 @@ CREATE TABLE `SS13_legacy_population` ( `server_name` varchar(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; /*!40101 SET character_set_client = @saved_cs_client */; @@ -255,7 +255,7 @@ CREATE TABLE `SS13_library` ( `ckey` varchar(32) NOT NULL DEFAULT 'LEGACY', `datetime` datetime NOT NULL, `deleted` tinyint(1) unsigned DEFAULT NULL, - `round_id_created` int(11) unsigned NOT NULL, + `round_id_created` int(11) unsigned NULL, PRIMARY KEY (`id`), KEY `deleted_idx` (`deleted`), KEY `idx_lib_id_del` (`id`,`deleted`), @@ -301,7 +301,7 @@ CREATE TABLE `SS13_messages` ( `server` varchar(32) DEFAULT NULL, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `secret` tinyint(1) unsigned NOT NULL, `expire_timestamp` datetime DEFAULT NULL, `severity` enum('high','medium','minor','none') DEFAULT NULL, @@ -365,9 +365,9 @@ CREATE TABLE `SS13_player` ( `ckey` varchar(32) NOT NULL, `byond_key` varchar(32) DEFAULT NULL, `firstseen` datetime NOT NULL, - `firstseen_round_id` int(11) unsigned NOT NULL, + `firstseen_round_id` int(11) unsigned NULL, `lastseen` datetime NOT NULL, - `lastseen_round_id` int(11) unsigned NOT NULL, + `lastseen_round_id` int(11) unsigned NULL, `ip` int(10) unsigned NOT NULL, `computerid` varchar(32) NOT NULL, `lastadminrank` varchar(32) NOT NULL DEFAULT 'Player', @@ -592,7 +592,7 @@ CREATE TABLE `SS13_ticket` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `server_ip` int(10) unsigned NOT NULL, `server_port` smallint(5) unsigned NOT NULL, - `round_id` int(11) unsigned NOT NULL, + `round_id` int(11) unsigned NULL, `ticket` smallint(11) unsigned NOT NULL, `action` varchar(20) NOT NULL DEFAULT 'Message', `message` text NOT NULL, diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index c7fd8fab66b..be5b604d558 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -20,7 +20,7 @@ * * make sure you add an update to the schema_version stable in the db changelog */ -#define DB_MINOR_VERSION 18 +#define DB_MINOR_VERSION 19 //! ## Timing subsystem