fix migration incase there is invalid data
This commit is contained in:
parent
17d4d2a925
commit
1038576ff4
1 changed files with 2 additions and 1 deletions
|
@ -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 (
|
||||||
|
|
Loading…
Reference in a new issue