From 5e83d5570d16c12aba84ac12e3bd8aa86991972a Mon Sep 17 00:00:00 2001 From: Kwoth Date: Tue, 10 Aug 2021 20:55:19 +0200 Subject: [PATCH] Fixed some migration issues which arose due to invalid database state. Upped version to beta3 --- .../Migrations/20210707002343_cleanup.cs | 67 ++++++++++--------- src/NadekoBot/Services/Impl/StatsService.cs | 2 +- 2 files changed, 38 insertions(+), 31 deletions(-) diff --git a/src/NadekoBot/Migrations/20210707002343_cleanup.cs b/src/NadekoBot/Migrations/20210707002343_cleanup.cs index d21ff3cee..6541d4a78 100644 --- a/src/NadekoBot/Migrations/20210707002343_cleanup.cs +++ b/src/NadekoBot/Migrations/20210707002343_cleanup.cs @@ -13,36 +13,10 @@ namespace NadekoBot.Migrations migrationBuilder.Sql("UPDATE Permission SET NextId = NULL;"); - migrationBuilder.DropTable( - name: "Permission"); - - migrationBuilder.DropTable( - name: "Stakes"); - - migrationBuilder.DropIndex( - name: "IX_GuildConfigs_RootPermissionId", - table: "GuildConfigs"); - - migrationBuilder.DropColumn( - name: "NotifyMessage", - table: "XpSettings"); - - migrationBuilder.DropColumn( - name: "XpRoleRewardExclusive", - table: "XpSettings"); - - migrationBuilder.DropColumn( - name: "Item", - table: "WaifuItem"); - - migrationBuilder.DropColumn( - name: "Price", - table: "WaifuItem"); - - migrationBuilder.DropColumn( - name: "UseCount", - table: "Quotes"); - + migrationBuilder.Sql("DELETE FROM FilteredWord WHERE GuildConfigId NOT IN (SELECT Id from GuildConfigs)"); + migrationBuilder.Sql("DELETE FROM FilterChannelId WHERE GuildConfigId NOT IN (SELECT Id from GuildConfigs)"); + migrationBuilder.Sql("DELETE FROM CommandCooldown WHERE GuildConfigId NOT IN (SELECT Id from GuildConfigs)"); + migrationBuilder.DropColumn( name: "ChannelCreated", table: "LogSettings"); @@ -106,6 +80,39 @@ namespace NadekoBot.Migrations migrationBuilder.DropColumn( name: "VoicePresenceChannelId", table: "LogSettings"); + + // todo cleanup guildconfigs which have logsettings id set to null + migrationBuilder.Sql("UPDATE GuildConfigs SET LogSettingId = null WHERE LogSettingId NOT IN (SELECT Id from LogSettings)"); + + migrationBuilder.DropTable( + name: "Permission"); + + migrationBuilder.DropTable( + name: "Stakes"); + + migrationBuilder.DropIndex( + name: "IX_GuildConfigs_RootPermissionId", + table: "GuildConfigs"); + + migrationBuilder.DropColumn( + name: "NotifyMessage", + table: "XpSettings"); + + migrationBuilder.DropColumn( + name: "XpRoleRewardExclusive", + table: "XpSettings"); + + migrationBuilder.DropColumn( + name: "Item", + table: "WaifuItem"); + + migrationBuilder.DropColumn( + name: "Price", + table: "WaifuItem"); + + migrationBuilder.DropColumn( + name: "UseCount", + table: "Quotes"); migrationBuilder.DropColumn( name: "AutoAssignRoleId", diff --git a/src/NadekoBot/Services/Impl/StatsService.cs b/src/NadekoBot/Services/Impl/StatsService.cs index 6d5fb2253..483764e29 100644 --- a/src/NadekoBot/Services/Impl/StatsService.cs +++ b/src/NadekoBot/Services/Impl/StatsService.cs @@ -19,7 +19,7 @@ namespace NadekoBot.Services private readonly IBotCredentials _creds; private readonly DateTime _started; - public const string BotVersion = "3.0.0-beta2"; + public const string BotVersion = "3.0.0-beta3"; public string Author => "Kwoth#2452"; public string Library => "Discord.Net";