fixed sar migration
This commit is contained in:
parent
8cab4094d2
commit
6be8403ac6
2 changed files with 13 additions and 11 deletions
|
@ -4,7 +4,7 @@
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>true</ImplicitUsings>
|
<ImplicitUsings>true</ImplicitUsings>
|
||||||
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
|
||||||
<Version>5.2.0</Version>
|
<Version>5.2.1</Version>
|
||||||
|
|
||||||
<!-- Output/build -->
|
<!-- Output/build -->
|
||||||
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
|
||||||
|
|
|
@ -21,15 +21,17 @@ public static class MigrationQueries
|
||||||
INNER JOIN GuildConfigs as GC ON GN.GuildConfigId = GC.Id;
|
INNER JOIN GuildConfigs as GC ON GN.GuildConfigId = GC.Id;
|
||||||
|
|
||||||
INSERT INTO Sar (GuildId, RoleId, SarGroupId, LevelReq)
|
INSERT INTO Sar (GuildId, RoleId, SarGroupId, LevelReq)
|
||||||
SELECT SAR.GuildId, SAR.RoleId, MIN(SG2.Id), MIN(SAR.LevelRequirement)
|
SELECT SAR.GuildId, SAR.RoleId, SG2.Id, MIN(SAR.LevelRequirement)
|
||||||
FROM SelfAssignableRoles as SAR
|
FROM SelfAssignableRoles as SAR
|
||||||
INNER JOIN (SELECT GuildId FROM GroupName as gn
|
INNER JOIN (SELECT GuildId FROM GroupName as gn
|
||||||
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
|
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
|
||||||
) as SG
|
) as SG
|
||||||
ON SG.GuildId = SAR.GuildId
|
ON SG.GuildId = SAR.GuildId
|
||||||
INNER JOIN GroupName as SG2
|
INNER JOIN (SELECT gn.Id, Number FROM GroupName as gn
|
||||||
ON SG2.Number = SAR."Group"
|
INNER JOIN GuildConfigs as gc ON gn.GuildConfigId =gc.Id
|
||||||
GROUP BY SAR.GuildId, SAR.RoleId;
|
) as SG2
|
||||||
|
ON SG2.Number = SAR."Group"
|
||||||
|
GROUP BY SAR.GuildId, SAR.RoleId;
|
||||||
|
|
||||||
INSERT INTO SarAutoDelete (GuildId, IsEnabled)
|
INSERT INTO SarAutoDelete (GuildId, IsEnabled)
|
||||||
SELECT GuildId, AutoDeleteSelfAssignedRoleMessages FROM GuildConfigs WHERE AutoDeleteSelfAssignedRoleMessages = TRUE;
|
SELECT GuildId, AutoDeleteSelfAssignedRoleMessages FROM GuildConfigs WHERE AutoDeleteSelfAssignedRoleMessages = TRUE;
|
||||||
|
@ -109,7 +111,7 @@ left join guildconfigs on reactionrolemessage.guildconfigid = guildconfigs.id;")
|
||||||
DELETE FROM WarningPunishment WHERE GuildConfigId IS NULL OR GuildConfigId NOT IN (SELECT Id FROM GuildConfigs);
|
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 (
|
||||||
SELECT wp2.Count, wp2.GuildConfigId FROM WarningPunishment as wp2
|
SELECT wp2.Count, wp2.GuildConfigId FROM WarningPunishment as wp2
|
||||||
|
|
Loading…
Reference in a new issue