From 8c58482efbe5bf3a4b79eb2c6cac03aed5de5c2a Mon Sep 17 00:00:00 2001 From: Timo Smit Date: Thu, 19 Mar 2020 20:56:55 +0100 Subject: [PATCH] Fixed mute command not working after next map (fixes #110) * this is due to a type issue --- database/new/sqlite.sql | 2 +- database/upgrade/1.2.0/sqlite.sql | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/database/new/sqlite.sql b/database/new/sqlite.sql index 1c942fa..4671b1d 100644 --- a/database/new/sqlite.sql +++ b/database/new/sqlite.sql @@ -62,7 +62,7 @@ CREATE TABLE IF NOT EXISTS `mute` ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `victim_id` INTEGER NOT NULL, `invoker_id` INTEGER NOT NULL, - `type` TEXT NOT NULL, + `type` INTEGER NOT NULL, `issued` INTEGER NOT NULL, `expires` INTEGER NOT NULL, `duration` INTEGER NOT NULL, diff --git a/database/upgrade/1.2.0/sqlite.sql b/database/upgrade/1.2.0/sqlite.sql index d5be177..f41191f 100644 --- a/database/upgrade/1.2.0/sqlite.sql +++ b/database/upgrade/1.2.0/sqlite.sql @@ -1,2 +1,27 @@ -- rename 'incognito' permission to 'noaka' UPDATE `player_permission` SET `permission`='noaka' WHERE `permission`='incognito'; + +-- fix mute type column type +ALTER TABLE `mute` RENAME TO `mute_old`; + +CREATE TABLE IF NOT EXISTS `mute` ( + `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, + `victim_id` INTEGER NOT NULL, + `invoker_id` INTEGER NOT NULL, + `type` INTEGER NOT NULL, + `issued` INTEGER NOT NULL, + `expires` INTEGER NOT NULL, + `duration` INTEGER NOT NULL, + `reason` TEXT NOT NULL, + CONSTRAINT `mute_victim` FOREIGN KEY (`victim_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION, + CONSTRAINT `mute_invoker` FOREIGN KEY (`invoker_id`) REFERENCES `player` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION +); + +CREATE INDEX IF NOT EXISTS `mute_victim_idx` ON `mute` (`victim_id`); +CREATE INDEX IF NOT EXISTS `mute_invoker_idx` ON `mute` (`invoker_id`); + +INSERT INTO `mute` (`id`, `victim_id`, `invoker_id`, `type`, `issued`, `expires`, `duration`, `reason`) + SELECT `id`, `victim_id`, `invoker_id`, `type`, `issued`, `expires`, `duration`, `reason` + FROM `mute_old`; + +DROP TABLE `mute_old`;