diff --git a/PluralKit.Core/Migrations/3.sql b/PluralKit.Core/Migrations/3.sql new file mode 100644 index 00000000..2dc0660b --- /dev/null +++ b/PluralKit.Core/Migrations/3.sql @@ -0,0 +1,13 @@ +-- Same sort of psuedo-enum due to Dapper limitations. See 2.sql. +-- 1 = autoproxy off +-- 2 = front mode (first fronter) +-- 3 = latch mode (last proxyer) +-- 4 = member mode (specific member) +alter table system_guild add column autoproxy_mode int check (autoproxy_mode in (1, 2, 3, 4)) not null default 1; + +-- for member mode +alter table system_guild add column autoproxy_member nullable references members (id) on delete set null; + +-- for latch mode +-- not *really* nullable, null just means old (pre-schema-change) data. +alter table messages add column guild bigint nullable default null; \ No newline at end of file diff --git a/PluralKit.Core/Stores.cs b/PluralKit.Core/Stores.cs index bc398083..4ce97068 100644 --- a/PluralKit.Core/Stores.cs +++ b/PluralKit.Core/Stores.cs @@ -9,6 +9,14 @@ using NodaTime; using Serilog; namespace PluralKit { + public enum AutoproxyMode + { + Off = 1, + Front = 2, + Latch = 3, + Member = 4 + } + public class FullMessage { public PKMessage Message; @@ -19,6 +27,7 @@ namespace PluralKit { public struct PKMessage { public ulong Mid; + public ulong? Guild; // null value means "no data" (ie. from before this field being added) public ulong Channel; public ulong Sender; public ulong? OriginalMid; @@ -63,6 +72,8 @@ namespace PluralKit { public ulong? LogChannel { get; set; } public ISet LogBlacklist { get; set; } public ISet Blacklist { get; set; } + public AutoproxyMode AutoproxyMode { get; set; } + public int AutoproxyMember { get; set; } } public class SystemGuildSettings