mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
fix: fix migration incase there is invalid data
This commit is contained in:
@@ -70,8 +70,9 @@ left join guildconfigs on reactionrolemessage.guildconfigid = guildconfigs.id;")
|
|||||||
public static void AddGuildIdsToWarningPunishment(MigrationBuilder builder)
|
public static void AddGuildIdsToWarningPunishment(MigrationBuilder builder)
|
||||||
{
|
{
|
||||||
builder.Sql("""
|
builder.Sql("""
|
||||||
|
DELETE FROM WarningPunishment WHERE GuildConfigId IS NULL OR GuildConfigId NOT IN (SELECT Id FROM GuildConfigs);
|
||||||
UPDATE WarningPunishment
|
UPDATE WarningPunishment
|
||||||
SET GuildId = (SELECT GuildId FROM guildconfigs WHERE Id = GuildConfigId);
|
SET GuildId = (SELECT GuildId FROM GuildConfigs WHERE Id = GuildConfigId);
|
||||||
|
|
||||||
DELETE FROM WarningPunishment as wp
|
DELETE FROM WarningPunishment as wp
|
||||||
WHERE (wp.Count, wp.GuildConfigId) in (
|
WHERE (wp.Count, wp.GuildConfigId) in (
|
||||||
|
Reference in New Issue
Block a user