Migrate guild objects to the patch system

This commit is contained in:
Ske
2020-06-29 15:20:28 +02:00
parent 467ce78522
commit 0598c53f62
11 changed files with 124 additions and 62 deletions

View File

@@ -214,9 +214,8 @@ namespace PluralKit.Bot
return;
}
await _db.Execute(c =>
c.ExecuteAsync("update system_guild set proxy_enabled = @newValue where system = @system and guild = @guild",
new {newValue, system = ctx.System.Id, guild = ctx.Guild.Id}));
var patch = new SystemGuildPatch {ProxyEnabled = newValue};
await _db.Execute(conn => conn.UpsertSystemGuild(ctx.System.Id, ctx.Guild.Id, patch));
if (newValue)
await ctx.Reply($"Message proxying in this server ({ctx.Guild.Name.EscapeMarkdown()}) is now **enabled** for your system.");