diff --git a/Iceshrimp.Backend/Core/Database/Migrations/20240614164941_FixupPollVotersCounts2.cs b/Iceshrimp.Backend/Core/Database/Migrations/20240614164941_FixupPollVotersCounts2.cs
new file mode 100644
index 00000000..c3fe309f
--- /dev/null
+++ b/Iceshrimp.Backend/Core/Database/Migrations/20240614164941_FixupPollVotersCounts2.cs
@@ -0,0 +1,25 @@
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+
+#nullable disable
+
+namespace Iceshrimp.Backend.Core.Database.Migrations
+{
+ ///
+ [DbContext(typeof(DatabaseContext))]
+ [Migration("20240614164941_FixupPollVotersCounts2")]
+ public partial class FixupPollVotersCounts2 : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.Sql("""UPDATE "poll" SET "votersCount" = (SELECT COUNT(*) FROM (SELECT DISTINCT "userId" FROM "poll_vote" WHERE "noteId" = "poll"."noteId") AS sq) WHERE "userHost" IS NULL AND "votersCount" IS NOT NULL;""");
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+
+ }
+ }
+}
diff --git a/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs b/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs
index 1843cbfa..f2b38800 100644
--- a/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs
+++ b/Iceshrimp.Backend/Core/Database/Migrations/DatabaseContextModelSnapshot.cs
@@ -19,7 +19,7 @@ namespace Iceshrimp.Backend.Core.Database.Migrations
{
#pragma warning disable 612, 618
modelBuilder
- .HasAnnotation("ProductVersion", "8.0.5")
+ .HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.HasPostgresEnum(modelBuilder, "antenna_src_enum", new[] { "home", "all", "users", "list", "group", "instances" });
diff --git a/Iceshrimp.Backend/Core/Services/PollService.cs b/Iceshrimp.Backend/Core/Services/PollService.cs
index 446da458..11e48361 100644
--- a/Iceshrimp.Backend/Core/Services/PollService.cs
+++ b/Iceshrimp.Backend/Core/Services/PollService.cs
@@ -20,7 +20,7 @@ public class PollService(
{
if (!updateVotersCount) return;
await db.Database
- .ExecuteSqlAsync($"""UPDATE "poll" SET "votersCount" = (SELECT COUNT(*) FROM (SELECT DISTINCT "userId" FROM "poll_vote" WHERE "noteId" = {poll.NoteId})) WHERE "noteId" = {poll.NoteId};""");
+ .ExecuteSqlAsync($"""UPDATE "poll" SET "votersCount" = (SELECT COUNT(*) FROM (SELECT DISTINCT "userId" FROM "poll_vote" WHERE "noteId" = {poll.NoteId}) AS sq) WHERE "noteId" = {poll.NoteId};""");
return;
}