From 94e003312d9e42b097a9797608fa39b8603e9821 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Thu, 28 Sep 2023 11:35:38 +0200 Subject: [PATCH] Fixed migration #378 --- .../configuration/feature_flags_enum.py | 2 +- .../configuration/feature_flags_settings.py | 2 +- .../migration/fix_updates_migration.py | 31 ++++++++++++++++++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/kdb-bot/src/bot_core/configuration/feature_flags_enum.py b/kdb-bot/src/bot_core/configuration/feature_flags_enum.py index f9b7f160..a370ef41 100644 --- a/kdb-bot/src/bot_core/configuration/feature_flags_enum.py +++ b/kdb-bot/src/bot_core/configuration/feature_flags_enum.py @@ -16,7 +16,7 @@ class FeatureFlagsEnum(Enum): level_module = "LevelModule" moderator_module = "ModeratorModule" permission_module = "PermissionModule" - short_role_name = "ShortRoleName" + short_role_name_module = "ShortRoleNameModule" # features api_only = "ApiOnly" presence = "Presence" diff --git a/kdb-bot/src/bot_core/configuration/feature_flags_settings.py b/kdb-bot/src/bot_core/configuration/feature_flags_settings.py index 4d4373cf..bf125e54 100644 --- a/kdb-bot/src/bot_core/configuration/feature_flags_settings.py +++ b/kdb-bot/src/bot_core/configuration/feature_flags_settings.py @@ -18,7 +18,7 @@ class FeatureFlagsSettings(ConfigurationModelABC): FeatureFlagsEnum.moderator_module.value: False, # 02.10.2022 #48 FeatureFlagsEnum.permission_module.value: True, # 02.10.2022 #48 FeatureFlagsEnum.config_module.value: True, # 19.07.2023 #127 - FeatureFlagsEnum.short_role_name.value: False, # 28.09.2023 #378 + FeatureFlagsEnum.short_role_name_module.value: False, # 28.09.2023 #378 # features FeatureFlagsEnum.api_only.value: False, # 13.10.2022 #70 FeatureFlagsEnum.presence.value: True, # 03.10.2022 #56 diff --git a/kdb-bot/src/bot_data/migration/fix_updates_migration.py b/kdb-bot/src/bot_data/migration/fix_updates_migration.py index 80f846a1..f4d5e020 100644 --- a/kdb-bot/src/bot_data/migration/fix_updates_migration.py +++ b/kdb-bot/src/bot_data/migration/fix_updates_migration.py @@ -15,8 +15,37 @@ class FixUpdatesMigration(MigrationABC): def upgrade(self): self._logger.debug(__name__, "Running upgrade") + self._cursor.execute( + str( + f""" + ALTER TABLE CFG_ServerHistory + ADD DefaultRoleId BIGINT NULL AFTER LoginMessageChannelId; + """ + ) + ) + + self._cursor.execute( + str( + """ALTER TABLE CFG_TechnicianHistory ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER CacheMaxMessages;""" + ) + ) + + self._cursor.execute( + str( + """ALTER TABLE CFG_ServerHistory ADD FeatureFlags JSON NULL DEFAULT ('{}') AFTER LoginMessageChannelId;""" + ) + ) + self._exec(__file__, "config/server.sql") self._exec(__file__, "config/technician.sql") def downgrade(self): - pass + self._cursor.execute( + str( + f""" + ALTER TABLE CFG_ServerHistory DROP COLUMN DefaultRoleId; + """ + ) + ) + self._cursor.execute("ALTER TABLE CFG_TechnicianHistory DROP COLUMN FeatureFlags;") + self._cursor.execute("ALTER TABLE CFG_ServerHistory DROP COLUMN FeatureFlags;")