From 4ba40b826a7989fd0445bee8144d6be38f3e834e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 15 Nov 2023 16:56:08 +0100 Subject: [PATCH] Fixed scripts #428 --- .../scripts/1.1.7/2_FixUpdates_up.sql | 24 ----------- .../1.1.9/1_ShortRoleNameOnlyHighest_up.sql | 26 ------------ .../scripts/1.2.0/1_FixUserHistory_up.sql | 13 ------ .../bot_data/scripts/1.2.0/2_Birthday_up.sql | 40 ------------------- .../scripts/1.2.0/4_MaxSteamOfferCount_up.sql | 15 ------- .../scripts/1.2.0/5_MaintenanceMode_up.sql | 16 -------- bot/src/bot_data/service/migration_service.py | 2 +- 7 files changed, 1 insertion(+), 135 deletions(-) diff --git a/bot/src/bot_data/scripts/1.1.7/2_FixUpdates_up.sql b/bot/src/bot_data/scripts/1.1.7/2_FixUpdates_up.sql index d4b289b4..c2e3845d 100644 --- a/bot/src/bot_data/scripts/1.1.7/2_FixUpdates_up.sql +++ b/bot/src/bot_data/scripts/1.1.7/2_FixUpdates_up.sql @@ -8,30 +8,6 @@ ALTER TABLE CFG_TechnicianHistory ALTER TABLE CFG_ServerHistory ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId; -CREATE TABLE IF NOT EXISTS `CFG_ServerHistory` -( - `Id` BIGINT(20) NOT NULL, - `MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6, - `NotificationChatId` BIGINT NOT NULL, - `MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6, - `XpPerMessage` BIGINT NOT NULL DEFAULT 1, - `XpPerReaction` BIGINT NOT NULL DEFAULT 1, - `MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20, - `XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10, - `XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10, - `XpPerAchievement` BIGINT NOT NULL DEFAULT 10, - `AFKCommandChannelId` BIGINT NOT NULL, - `HelpVoiceChannelId` BIGINT NOT NULL, - `TeamChannelId` BIGINT NOT NULL, - `LoginMessageChannelId` BIGINT NOT NULL, - `DefaultRoleId` BIGINT NULL, - `FeatureFlags` JSON NULL DEFAULT ('{}'), - `ServerId` BIGINT NOT NULL, - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;; CREATE TRIGGER `TR_CFG_ServerUpdate` diff --git a/bot/src/bot_data/scripts/1.1.9/1_ShortRoleNameOnlyHighest_up.sql b/bot/src/bot_data/scripts/1.1.9/1_ShortRoleNameOnlyHighest_up.sql index 4ef565fa..e90f3006 100644 --- a/bot/src/bot_data/scripts/1.1.9/1_ShortRoleNameOnlyHighest_up.sql +++ b/bot/src/bot_data/scripts/1.1.9/1_ShortRoleNameOnlyHighest_up.sql @@ -6,32 +6,6 @@ ALTER TABLE CFG_Server ALTER TABLE CFG_ServerHistory ADD ShortRoleNameSetOnlyHighest BOOLEAN NOT NULL DEFAULT FALSE AFTER DefaultRoleId; - -CREATE TABLE IF NOT EXISTS `CFG_ServerHistory` -( - `Id` BIGINT(20) NOT NULL, - `MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6, - `NotificationChatId` BIGINT NOT NULL, - `MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6, - `XpPerMessage` BIGINT NOT NULL DEFAULT 1, - `XpPerReaction` BIGINT NOT NULL DEFAULT 1, - `MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20, - `XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10, - `XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10, - `XpPerAchievement` BIGINT NOT NULL DEFAULT 10, - `AFKCommandChannelId` BIGINT NOT NULL, - `HelpVoiceChannelId` BIGINT NOT NULL, - `TeamChannelId` BIGINT NOT NULL, - `LoginMessageChannelId` BIGINT NOT NULL, - `DefaultRoleId` BIGINT NULL, - `ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE, - `FeatureFlags` JSON NULL DEFAULT ('{}'), - `ServerId` BIGINT NOT NULL, - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;; CREATE TRIGGER `TR_CFG_ServerUpdate` diff --git a/bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_up.sql b/bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_up.sql index 404c035f..a4997576 100644 --- a/bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_up.sql +++ b/bot/src/bot_data/scripts/1.2.0/1_FixUserHistory_up.sql @@ -4,19 +4,6 @@ ALTER TABLE `Users` ALTER TABLE `Users` CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);; -CREATE TABLE IF NOT EXISTS `UsersHistory` -( - `Id` BIGINT(20) NOT NULL, - `DiscordId` BIGINT(20) NOT NULL, - `XP` BIGINT(20) NOT NULL DEFAULT 0, - `ReactionCount` BIGINT(20) NOT NULL DEFAULT 0, - `MessageCount` BIGINT(20) NOT NULL DEFAULT 0, - `ServerId` BIGINT(20) DEFAULT NULL, - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_UsersUpdate`;; CREATE TRIGGER `TR_UsersUpdate` diff --git a/bot/src/bot_data/scripts/1.2.0/2_Birthday_up.sql b/bot/src/bot_data/scripts/1.2.0/2_Birthday_up.sql index 8bde9a87..fa92e8e8 100644 --- a/bot/src/bot_data/scripts/1.2.0/2_Birthday_up.sql +++ b/bot/src/bot_data/scripts/1.2.0/2_Birthday_up.sql @@ -13,20 +13,6 @@ ALTER TABLE `Users` ALTER TABLE `Users` CHANGE `LastModifiedAt` `LastModifiedAt` DATETIME(6) NULL DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6);; -CREATE TABLE IF NOT EXISTS `UsersHistory` -( - `Id` BIGINT(20) NOT NULL, - `DiscordId` BIGINT(20) NOT NULL, - `XP` BIGINT(20) NOT NULL DEFAULT 0, - `ReactionCount` BIGINT(20) NOT NULL DEFAULT 0, - `MessageCount` BIGINT(20) NOT NULL DEFAULT 0, - `Birthday` DATE NULL, - `ServerId` BIGINT(20) DEFAULT NULL, - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_UsersUpdate`;; CREATE TRIGGER `TR_UsersUpdate` @@ -62,32 +48,6 @@ ALTER TABLE CFG_Server ALTER TABLE CFG_ServerHistory ADD XpForBirthday BIGINT(20) NOT NULL DEFAULT 0 AFTER XpPerAchievement; - -CREATE TABLE IF NOT EXISTS `CFG_ServerHistory` -( - `Id` BIGINT(20) NOT NULL, - `MessageDeleteTimer` BIGINT NOT NULL DEFAULT 6, - `NotificationChatId` BIGINT NOT NULL, - `MaxVoiceStateHours` BIGINT NOT NULL DEFAULT 6, - `XpPerMessage` BIGINT NOT NULL DEFAULT 1, - `XpPerReaction` BIGINT NOT NULL DEFAULT 1, - `MaxMessageXpPerHour` BIGINT NOT NULL DEFAULT 20, - `XpPerOntimeHour` BIGINT NOT NULL DEFAULT 10, - `XpPerEventParticipation` BIGINT NOT NULL DEFAULT 10, - `XpPerAchievement` BIGINT NOT NULL DEFAULT 10, - `AFKCommandChannelId` BIGINT NOT NULL, - `HelpVoiceChannelId` BIGINT NOT NULL, - `TeamChannelId` BIGINT NOT NULL, - `LoginMessageChannelId` BIGINT NOT NULL, - `DefaultRoleId` BIGINT NULL, - `ShortRoleNameSetOnlyHighest` BOOLEAN NOT NULL DEFAULT FALSE, - `FeatureFlags` JSON NULL DEFAULT ('{}'), - `ServerId` BIGINT NOT NULL, - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_CFG_ServerUpdate`;; CREATE TRIGGER `TR_CFG_ServerUpdate` diff --git a/bot/src/bot_data/scripts/1.2.0/4_MaxSteamOfferCount_up.sql b/bot/src/bot_data/scripts/1.2.0/4_MaxSteamOfferCount_up.sql index 65289d0a..f9f21398 100644 --- a/bot/src/bot_data/scripts/1.2.0/4_MaxSteamOfferCount_up.sql +++ b/bot/src/bot_data/scripts/1.2.0/4_MaxSteamOfferCount_up.sql @@ -6,21 +6,6 @@ ALTER TABLE CFG_Technician ALTER TABLE CFG_TechnicianHistory ADD MaxSteamOfferCount BIGINT NOT NULL DEFAULT 250 AFTER CacheMaxMessages; - -CREATE TABLE IF NOT EXISTS `CFG_TechnicianHistory` -( - `Id` BIGINT(20) NOT NULL, - `HelpCommandReferenceUrl` VARCHAR(255) NOT NULL, - `WaitForRestart` BIGINT NOT NULL DEFAULT 8, - `WaitForShutdown` BIGINT NOT NULL DEFAULT 8, - `CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000, - `MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250, - `FeatureFlags` JSON NULL DEFAULT ('{}'), - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;; CREATE TRIGGER `TR_CFG_TechnicianUpdate` diff --git a/bot/src/bot_data/scripts/1.2.0/5_MaintenanceMode_up.sql b/bot/src/bot_data/scripts/1.2.0/5_MaintenanceMode_up.sql index fb709e98..895e24ad 100644 --- a/bot/src/bot_data/scripts/1.2.0/5_MaintenanceMode_up.sql +++ b/bot/src/bot_data/scripts/1.2.0/5_MaintenanceMode_up.sql @@ -6,22 +6,6 @@ ALTER TABLE CFG_Technician ALTER TABLE CFG_TechnicianHistory ADD Maintenance BOOLEAN DEFAULT FALSE AFTER MaxSteamOfferCount; - -CREATE TABLE IF NOT EXISTS `CFG_TechnicianHistory` -( - `Id` BIGINT(20) NOT NULL, - `HelpCommandReferenceUrl` VARCHAR(255) NOT NULL, - `WaitForRestart` BIGINT NOT NULL DEFAULT 8, - `WaitForShutdown` BIGINT NOT NULL DEFAULT 8, - `CacheMaxMessages` BIGINT NOT NULL DEFAULT 1000000, - `MaxSteamOfferCount` BIGINT NOT NULL DEFAULT 250, - `Maintenance` BOOLEAN DEFAULT FALSE, - `FeatureFlags` JSON NULL DEFAULT ('{}'), - `Deleted` BOOL DEFAULT FALSE, - `DateFrom` DATETIME(6) NOT NULL, - `DateTo` DATETIME(6) NOT NULL -);; - DROP TRIGGER IF EXISTS `TR_CFG_TechnicianUpdate`;; CREATE TRIGGER `TR_CFG_TechnicianUpdate` diff --git a/bot/src/bot_data/service/migration_service.py b/bot/src/bot_data/service/migration_service.py index 76aae60d..b2356eaa 100644 --- a/bot/src/bot_data/service/migration_service.py +++ b/bot/src/bot_data/service/migration_service.py @@ -41,7 +41,7 @@ class MigrationService: if migration.migration_id.endswith("Migration"): return - self._logger.debug(__name__, f"Migrate old migration {migration.migration_id} to new method") + self._logger.debug(__name__, f"Migrate new migration {migration.migration_id} to old method") self._cursor.execute(migration.change_id_string(f"{migration.migration_id}Migration")) self._db.save_changes()