diff --git a/src/EllieBot/Migrations/Sqlite/20250126062816_cleanup.sql b/src/EllieBot/Migrations/Sqlite/20250126062816_cleanup.sql index fa8bfcd..72b40a0 100644 --- a/src/EllieBot/Migrations/Sqlite/20250126062816_cleanup.sql +++ b/src/EllieBot/Migrations/Sqlite/20250126062816_cleanup.sql @@ -171,7 +171,7 @@ DELETE FROM Permissions WHERE GuildConfigId IS NULL OR GuildConfigId NOT IN (SEL UPDATE Permissions SET GuildId = (SELECT GuildId FROM GuildConfigs WHERE GuildConfigs.Id = Permissions.GuildConfigId); -DELETE FROM MutedUserId WHERE GuildConfigId IS NULL OR GuildConfigId NOT IN (SELECT Id FROM GuildConfigs); +DELETE FROM MutedUserId WHERE GuildConfigId IS NULL OR GuildConfigId NOT IN (SELECT Id FROM GuildConfigs) OR (GuildId, UserId) IN (SELECT GuildId, UserId FROM MutedUserId GROUP BY GuildId, UserId HAVING COUNT(*) > 1); UPDATE MutedUserId SET GuildId = (SELECT GuildId FROM GuildConfigs WHERE GuildConfigs.Id = MutedUserId.GuildConfigId); @@ -763,4 +763,3 @@ INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion") VALUES ('20250126062816_cleanup', '8.0.8'); COMMIT; -