From 62a01d3d066e47819d07dfbbcf224e52c8055745 Mon Sep 17 00:00:00 2001
From: Toastie <toastie@toastiet0ast.com>
Date: Sun, 16 Mar 2025 15:44:51 +1300
Subject: [PATCH] fixed protection commands not properly turning on

---
 src/EllieBot/Db/Models/FollowedStream.cs               |  3 ++-
 src/EllieBot/Db/Models/anti/AntiAltSetting.cs          |  4 ----
 src/EllieBot/Db/Models/anti/AntiSpamSetting.cs         |  2 --
 .../PostgreSql/20250315225518_prot-delete-gcid.sql     |  9 +++++++++
 ...nit.Designer.cs => 20250315225539_init.Designer.cs} | 10 +---------
 .../{20250315193847_init.cs => 20250315225539_init.cs} |  2 --
 .../PostgreSql/PostgreSqlContextModelSnapshot.cs       |  8 --------
 .../Sqlite/20250315225515_prot-delete-gcid.sql         |  9 +++++++++
 ...nit.Designer.cs => 20250315225536_init.Designer.cs} |  8 +-------
 .../{20250315193844_init.cs => 20250315225536_init.cs} |  2 --
 .../Migrations/Sqlite/SqliteContextModelSnapshot.cs    |  6 ------
 11 files changed, 22 insertions(+), 41 deletions(-)
 create mode 100644 src/EllieBot/Migrations/PostgreSql/20250315225518_prot-delete-gcid.sql
 rename src/EllieBot/Migrations/PostgreSql/{20250315193847_init.Designer.cs => 20250315225539_init.Designer.cs} (99%)
 rename src/EllieBot/Migrations/PostgreSql/{20250315193847_init.cs => 20250315225539_init.cs} (99%)
 create mode 100644 src/EllieBot/Migrations/Sqlite/20250315225515_prot-delete-gcid.sql
 rename src/EllieBot/Migrations/Sqlite/{20250315193844_init.Designer.cs => 20250315225536_init.Designer.cs} (99%)
 rename src/EllieBot/Migrations/Sqlite/{20250315193844_init.cs => 20250315225536_init.cs} (99%)

diff --git a/src/EllieBot/Db/Models/FollowedStream.cs b/src/EllieBot/Db/Models/FollowedStream.cs
index a9e48a1..2a0c83c 100644
--- a/src/EllieBot/Db/Models/FollowedStream.cs
+++ b/src/EllieBot/Db/Models/FollowedStream.cs
@@ -1,3 +1,4 @@
+#nullable disable
 using Microsoft.EntityFrameworkCore;
 using Microsoft.EntityFrameworkCore.Metadata.Builders;
 
@@ -17,7 +18,7 @@ public class FollowedStream
     public int Id { get; set; }
     public ulong GuildId { get; set; }
     public ulong ChannelId { get; set; }
-    public string Username { get; set; } = string.Empty;
+    public string Username { get; set; }
     public string? PrettyName { get; set; } = null;
     public FType Type { get; set; }
     public string? Message { get; set; } = null;
diff --git a/src/EllieBot/Db/Models/anti/AntiAltSetting.cs b/src/EllieBot/Db/Models/anti/AntiAltSetting.cs
index 1a5f051..d6f4d11 100644
--- a/src/EllieBot/Db/Models/anti/AntiAltSetting.cs
+++ b/src/EllieBot/Db/Models/anti/AntiAltSetting.cs
@@ -11,11 +11,7 @@ public class AntiAltSetting
 {
     [Key]
     public int Id { get; set; }
-
-    public int GuildConfigId { get; set; }
-
     public ulong GuildId { get; set; }
-
     public TimeSpan MinAge { get; set; }
     public PunishmentAction Action { get; set; }
     public int ActionDurationMinutes { get; set; }
diff --git a/src/EllieBot/Db/Models/anti/AntiSpamSetting.cs b/src/EllieBot/Db/Models/anti/AntiSpamSetting.cs
index 6f335f0..7cc44cc 100644
--- a/src/EllieBot/Db/Models/anti/AntiSpamSetting.cs
+++ b/src/EllieBot/Db/Models/anti/AntiSpamSetting.cs
@@ -8,8 +8,6 @@ namespace EllieBot.Db.Models;
 #nullable disable
 public class AntiSpamSetting : DbEntity
 {
-    public int GuildConfigId { get; set; }
-
     public ulong GuildId { get; set; }
 
     public PunishmentAction Action { get; set; }
diff --git a/src/EllieBot/Migrations/PostgreSql/20250315225518_prot-delete-gcid.sql b/src/EllieBot/Migrations/PostgreSql/20250315225518_prot-delete-gcid.sql
new file mode 100644
index 0000000..c69cecd
--- /dev/null
+++ b/src/EllieBot/Migrations/PostgreSql/20250315225518_prot-delete-gcid.sql
@@ -0,0 +1,9 @@
+START TRANSACTION;
+ALTER TABLE antispamsetting DROP COLUMN guildconfigid;
+
+ALTER TABLE antialtsetting DROP COLUMN guildconfigid;
+
+INSERT INTO "__EFMigrationsHistory" (migrationid, productversion)
+VALUES ('20250315225518_prot-delete-gcid', '9.0.1');
+
+COMMIT;
diff --git a/src/EllieBot/Migrations/PostgreSql/20250315193847_init.Designer.cs b/src/EllieBot/Migrations/PostgreSql/20250315225539_init.Designer.cs
similarity index 99%
rename from src/EllieBot/Migrations/PostgreSql/20250315193847_init.Designer.cs
rename to src/EllieBot/Migrations/PostgreSql/20250315225539_init.Designer.cs
index 6505a34..b047a58 100644
--- a/src/EllieBot/Migrations/PostgreSql/20250315193847_init.Designer.cs
+++ b/src/EllieBot/Migrations/PostgreSql/20250315225539_init.Designer.cs
@@ -12,7 +12,7 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
 namespace EllieBot.Migrations.PostgreSql
 {
     [DbContext(typeof(PostgreSqlContext))]
-    [Migration("20250315193847_init")]
+    [Migration("20250315225539_init")]
     partial class init
     {
         /// <inheritdoc />
@@ -42,10 +42,6 @@ namespace EllieBot.Migrations.PostgreSql
                     .HasColumnType("integer")
                     .HasColumnName("actiondurationminutes");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("integer")
-                    .HasColumnName("guildconfigid");
-
                 b.Property<decimal>("GuildId")
                     .HasColumnType("numeric(20,0)")
                     .HasColumnName("guildid");
@@ -158,10 +154,6 @@ namespace EllieBot.Migrations.PostgreSql
                     .HasColumnType("timestamp without time zone")
                     .HasColumnName("dateadded");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("integer")
-                    .HasColumnName("guildconfigid");
-
                 b.Property<decimal>("GuildId")
                     .HasColumnType("numeric(20,0)")
                     .HasColumnName("guildid");
diff --git a/src/EllieBot/Migrations/PostgreSql/20250315193847_init.cs b/src/EllieBot/Migrations/PostgreSql/20250315225539_init.cs
similarity index 99%
rename from src/EllieBot/Migrations/PostgreSql/20250315193847_init.cs
rename to src/EllieBot/Migrations/PostgreSql/20250315225539_init.cs
index 8cee9e9..3e0f8d2 100644
--- a/src/EllieBot/Migrations/PostgreSql/20250315193847_init.cs
+++ b/src/EllieBot/Migrations/PostgreSql/20250315225539_init.cs
@@ -18,7 +18,6 @@ namespace EllieBot.Migrations.PostgreSql
                 {
                     id = table.Column<int>(type: "integer", nullable: false)
                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
-                    guildconfigid = table.Column<int>(type: "integer", nullable: false),
                     guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
                     minage = table.Column<TimeSpan>(type: "interval", nullable: false),
                     action = table.Column<int>(type: "integer", nullable: false),
@@ -54,7 +53,6 @@ namespace EllieBot.Migrations.PostgreSql
                 {
                     id = table.Column<int>(type: "integer", nullable: false)
                         .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
-                    guildconfigid = table.Column<int>(type: "integer", nullable: false),
                     guildid = table.Column<decimal>(type: "numeric(20,0)", nullable: false),
                     action = table.Column<int>(type: "integer", nullable: false),
                     messagethreshold = table.Column<int>(type: "integer", nullable: false),
diff --git a/src/EllieBot/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs b/src/EllieBot/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs
index 54b0b73..fc8795f 100644
--- a/src/EllieBot/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs
+++ b/src/EllieBot/Migrations/PostgreSql/PostgreSqlContextModelSnapshot.cs
@@ -39,10 +39,6 @@ namespace EllieBot.Migrations.PostgreSql
                     .HasColumnType("integer")
                     .HasColumnName("actiondurationminutes");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("integer")
-                    .HasColumnName("guildconfigid");
-
                 b.Property<decimal>("GuildId")
                     .HasColumnType("numeric(20,0)")
                     .HasColumnName("guildid");
@@ -155,10 +151,6 @@ namespace EllieBot.Migrations.PostgreSql
                     .HasColumnType("timestamp without time zone")
                     .HasColumnName("dateadded");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("integer")
-                    .HasColumnName("guildconfigid");
-
                 b.Property<decimal>("GuildId")
                     .HasColumnType("numeric(20,0)")
                     .HasColumnName("guildid");
diff --git a/src/EllieBot/Migrations/Sqlite/20250315225515_prot-delete-gcid.sql b/src/EllieBot/Migrations/Sqlite/20250315225515_prot-delete-gcid.sql
new file mode 100644
index 0000000..f5c58ab
--- /dev/null
+++ b/src/EllieBot/Migrations/Sqlite/20250315225515_prot-delete-gcid.sql
@@ -0,0 +1,9 @@
+BEGIN TRANSACTION;
+ALTER TABLE "AntiSpamSetting" DROP COLUMN "GuildConfigId";
+
+ALTER TABLE "AntiAltSetting" DROP COLUMN "GuildConfigId";
+
+INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
+VALUES ('20250315225515_prot-delete-gcid', '9.0.1');
+
+COMMIT;
\ No newline at end of file
diff --git a/src/EllieBot/Migrations/Sqlite/20250315193844_init.Designer.cs b/src/EllieBot/Migrations/Sqlite/20250315225536_init.Designer.cs
similarity index 99%
rename from src/EllieBot/Migrations/Sqlite/20250315193844_init.Designer.cs
rename to src/EllieBot/Migrations/Sqlite/20250315225536_init.Designer.cs
index 0f1e732..47bbdcd 100644
--- a/src/EllieBot/Migrations/Sqlite/20250315193844_init.Designer.cs
+++ b/src/EllieBot/Migrations/Sqlite/20250315225536_init.Designer.cs
@@ -11,7 +11,7 @@ using EllieBot.Db;
 namespace EllieBot.Migrations.Sqlite
 {
     [DbContext(typeof(SqliteContext))]
-    [Migration("20250315193844_init")]
+    [Migration("20250315225536_init")]
     partial class init
     {
         /// <inheritdoc />
@@ -32,9 +32,6 @@ namespace EllieBot.Migrations.Sqlite
                 b.Property<int>("ActionDurationMinutes")
                     .HasColumnType("INTEGER");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("INTEGER");
-
                 b.Property<ulong>("GuildId")
                     .HasColumnType("INTEGER");
 
@@ -118,9 +115,6 @@ namespace EllieBot.Migrations.Sqlite
                 b.Property<DateTime?>("DateAdded")
                     .HasColumnType("TEXT");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("INTEGER");
-
                 b.Property<ulong>("GuildId")
                     .HasColumnType("INTEGER");
 
diff --git a/src/EllieBot/Migrations/Sqlite/20250315193844_init.cs b/src/EllieBot/Migrations/Sqlite/20250315225536_init.cs
similarity index 99%
rename from src/EllieBot/Migrations/Sqlite/20250315193844_init.cs
rename to src/EllieBot/Migrations/Sqlite/20250315225536_init.cs
index 1b04e26..c142ccf 100644
--- a/src/EllieBot/Migrations/Sqlite/20250315193844_init.cs
+++ b/src/EllieBot/Migrations/Sqlite/20250315225536_init.cs
@@ -17,7 +17,6 @@ namespace EllieBot.Migrations.Sqlite
                 {
                     Id = table.Column<int>(type: "INTEGER", nullable: false)
                         .Annotation("Sqlite:Autoincrement", true),
-                    GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
                     GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
                     MinAge = table.Column<TimeSpan>(type: "TEXT", nullable: false),
                     Action = table.Column<int>(type: "INTEGER", nullable: false),
@@ -53,7 +52,6 @@ namespace EllieBot.Migrations.Sqlite
                 {
                     Id = table.Column<int>(type: "INTEGER", nullable: false)
                         .Annotation("Sqlite:Autoincrement", true),
-                    GuildConfigId = table.Column<int>(type: "INTEGER", nullable: false),
                     GuildId = table.Column<ulong>(type: "INTEGER", nullable: false),
                     Action = table.Column<int>(type: "INTEGER", nullable: false),
                     MessageThreshold = table.Column<int>(type: "INTEGER", nullable: false),
diff --git a/src/EllieBot/Migrations/Sqlite/SqliteContextModelSnapshot.cs b/src/EllieBot/Migrations/Sqlite/SqliteContextModelSnapshot.cs
index a8b88b9..7a30ffb 100644
--- a/src/EllieBot/Migrations/Sqlite/SqliteContextModelSnapshot.cs
+++ b/src/EllieBot/Migrations/Sqlite/SqliteContextModelSnapshot.cs
@@ -29,9 +29,6 @@ namespace EllieBot.Migrations.Sqlite
                 b.Property<int>("ActionDurationMinutes")
                     .HasColumnType("INTEGER");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("INTEGER");
-
                 b.Property<ulong>("GuildId")
                     .HasColumnType("INTEGER");
 
@@ -115,9 +112,6 @@ namespace EllieBot.Migrations.Sqlite
                 b.Property<DateTime?>("DateAdded")
                     .HasColumnType("TEXT");
 
-                b.Property<int>("GuildConfigId")
-                    .HasColumnType("INTEGER");
-
                 b.Property<ulong>("GuildId")
                     .HasColumnType("INTEGER");