From 8c3c970e74849478e16243e5a7979c3ca79bd685 Mon Sep 17 00:00:00 2001
From: ptlthg <24925519+ptlthg@users.noreply.github.com>
Date: Tue, 13 Jan 2026 21:27:38 -0500
Subject: [PATCH 1/2] Fix guild stat queries not using good indexes
---
...2911_AddLatestFlagToGuildStats.Designer.cs | 5405 +++++++++++++++++
...0260114012911_AddLatestFlagToGuildStats.cs | 48 +
2 files changed, 5453 insertions(+)
create mode 100644 EliteAPI/Data/Migrations/20260114012911_AddLatestFlagToGuildStats.Designer.cs
create mode 100644 EliteAPI/Data/Migrations/20260114012911_AddLatestFlagToGuildStats.cs
diff --git a/EliteAPI/Data/Migrations/20260114012911_AddLatestFlagToGuildStats.Designer.cs b/EliteAPI/Data/Migrations/20260114012911_AddLatestFlagToGuildStats.Designer.cs
new file mode 100644
index 00000000..e40aeac5
--- /dev/null
+++ b/EliteAPI/Data/Migrations/20260114012911_AddLatestFlagToGuildStats.Designer.cs
@@ -0,0 +1,5405 @@
+//
+using System;
+using System.Collections.Generic;
+using EliteAPI.Data;
+using EliteAPI.Features.Account.DTOs;
+using EliteAPI.Features.Account.Models;
+using EliteAPI.Features.Guides.Models;
+using EliteAPI.Features.Leaderboards.Models;
+using EliteAPI.Features.Profiles.Models;
+using EliteAPI.Features.Recap.Models;
+using EliteAPI.Features.Resources.Bazaar;
+using EliteAPI.Models.DTOs.Outgoing;
+using EliteAPI.Models.Entities.Discord;
+using EliteAPI.Models.Entities.Events;
+using EliteAPI.Models.Entities.Farming;
+using EliteAPI.Models.Entities.Hypixel;
+using EliteAPI.Models.Entities.Monetization;
+using EliteFarmers.HypixelAPI.DTOs;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
+
+#nullable disable
+
+namespace EliteAPI.Data.Migrations
+{
+ [DbContext(typeof(DataContext))]
+ [Migration("20260114012911_AddLatestFlagToGuildStats")]
+ partial class AddLatestFlagToGuildStats
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("Npgsql:CollationDefinition:case_insensitive", "en-u-ks-primary,en-u-ks-primary,icu,False")
+ .HasAnnotation("ProductVersion", "10.0.1")
+ .HasAnnotation("Relational:MaxIdentifierLength", 63);
+
+ NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
+
+ modelBuilder.Entity("EliteAPI.Features.Account.Models.Badge", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(1024)
+ .HasColumnType("character varying(1024)");
+
+ b.Property("ImageId")
+ .HasMaxLength(48)
+ .HasColumnType("character varying(48)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("Requirements")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("TieToAccount")
+ .HasColumnType("boolean");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ImageId");
+
+ b.ToTable("Badges");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Account.Models.EliteAccount", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("ActiveRewards")
+ .HasColumnType("boolean");
+
+ b.Property("Avatar")
+ .HasColumnType("text");
+
+ b.Property("Data")
+ .HasColumnType("jsonb");
+
+ b.Property("Discriminator")
+ .HasColumnType("text");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Locale")
+ .HasColumnType("text");
+
+ b.Property("Permissions")
+ .HasColumnType("integer");
+
+ b.Property("UserSettingsId")
+ .HasColumnType("integer");
+
+ b.Property("Username")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserSettingsId");
+
+ b.ToTable("Accounts");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Account.Models.MinecraftAccount", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("AccountId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("Face")
+ .HasColumnType("bytea");
+
+ b.Property>("FlagReasons")
+ .HasColumnType("jsonb");
+
+ b.Property("Flags")
+ .HasColumnType("integer");
+
+ b.Property("GuildLastUpdated")
+ .HasColumnType("bigint");
+
+ b.Property("Hat")
+ .HasColumnType("bytea");
+
+ b.Property("LastUpdated")
+ .HasColumnType("bigint");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text")
+ .UseCollation("case_insensitive");
+
+ b.Property("PlayerDataLastUpdated")
+ .HasColumnType("bigint");
+
+ b.Property("ProfilesLastUpdated")
+ .HasColumnType("bigint");
+
+ b.Property("Selected")
+ .HasColumnType("boolean");
+
+ b.Property("TextureId")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountId");
+
+ b.HasIndex(new[] { "Name" }, "idx_minecraft_accounts_name");
+
+ b.ToTable("MinecraftAccounts");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Account.Models.UserBadge", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("BadgeId")
+ .HasColumnType("integer");
+
+ b.Property("MinecraftAccountId")
+ .IsRequired()
+ .HasMaxLength(36)
+ .HasColumnType("character varying(36)");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.Property("Timestamp")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Visible")
+ .HasColumnType("boolean");
+
+ b.HasKey("Id");
+
+ b.HasIndex("BadgeId");
+
+ b.HasIndex("MinecraftAccountId");
+
+ b.ToTable("UserBadges");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Account.Models.UserSettings", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CustomLeaderboardStyle")
+ .HasColumnType("jsonb");
+
+ b.Property("EmojiUrl")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("Features")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property("Fortune")
+ .HasColumnType("jsonb");
+
+ b.Property("LeaderboardStyleId")
+ .HasColumnType("integer");
+
+ b.Property("NameStyleId")
+ .HasColumnType("integer");
+
+ b.Property("Prefix")
+ .HasMaxLength(16)
+ .HasColumnType("character varying(16)");
+
+ b.Property("Suffix")
+ .HasMaxLength(16)
+ .HasColumnType("character varying(16)");
+
+ b.Property("WeightStyleId")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("LeaderboardStyleId");
+
+ b.HasIndex("NameStyleId");
+
+ b.HasIndex("WeightStyleId");
+
+ b.ToTable("UserSettings");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Announcements.Models.Announcement", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("uuid");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasMaxLength(8192)
+ .HasColumnType("character varying(8192)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExpiresAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("TargetEndsAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("TargetLabel")
+ .HasColumnType("text");
+
+ b.Property("TargetStartsAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("TargetUrl")
+ .HasColumnType("text");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.ToTable("Announcements");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Announcements.Models.DismissedAnnouncement", b =>
+ {
+ b.Property("AnnouncementId")
+ .HasColumnType("uuid");
+
+ b.Property("AccountId")
+ .HasColumnType("numeric(20,0)");
+
+ b.HasKey("AnnouncementId", "AccountId");
+
+ b.HasIndex("AccountId");
+
+ b.ToTable("DismissedAnnouncements");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.AuditLogs.Models.AdminAuditLog", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Action")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("AdminUserId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property>("Data")
+ .HasColumnType("jsonb");
+
+ b.Property("Details")
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("TargetId")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("TargetType")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Action");
+
+ b.HasIndex("AdminUserId");
+
+ b.HasIndex("CreatedAt");
+
+ b.HasIndex("TargetType");
+
+ b.ToTable("AdminAuditLogs");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Auth.Models.ApiUser", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("AccessFailedCount")
+ .HasColumnType("integer");
+
+ b.Property("AccountId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .HasColumnType("text");
+
+ b.Property("DiscordAccessToken")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("DiscordAccessTokenExpires")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DiscordRefreshToken")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("DiscordRefreshTokenExpires")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Email")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("EmailConfirmed")
+ .HasColumnType("boolean");
+
+ b.Property("GuildsLastUpdated")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("LockoutEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("LockoutEnd")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("NormalizedEmail")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("NormalizedUserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("PasswordHash")
+ .HasColumnType("text");
+
+ b.Property("PhoneNumber")
+ .HasColumnType("text");
+
+ b.Property("PhoneNumberConfirmed")
+ .HasColumnType("boolean");
+
+ b.Property("SecurityStamp")
+ .HasColumnType("text");
+
+ b.Property("TwoFactorEnabled")
+ .HasColumnType("boolean");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AccountId");
+
+ b.HasIndex("NormalizedEmail")
+ .HasDatabaseName("EmailIndex");
+
+ b.HasIndex("NormalizedUserName")
+ .IsUnique()
+ .HasDatabaseName("UserNameIndex");
+
+ b.ToTable("AspNetUsers", (string)null);
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Auth.Models.RefreshToken", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityAlwaysColumn(b.Property("Id"));
+
+ b.Property("CreatedUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ExpiresUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("RevokedUtc")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Token")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("UserId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId", "Token");
+
+ b.ToTable("RefreshTokens");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Confirmations.Models.Confirmation", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Content")
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("IsActive")
+ .HasColumnType("boolean");
+
+ b.Property("Title")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.ToTable("Confirmations");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Confirmations.Models.UserConfirmation", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("text");
+
+ b.Property("ConfirmationId")
+ .HasColumnType("integer");
+
+ b.Property("ConfirmedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("UserId", "ConfirmationId");
+
+ b.HasIndex("ConfirmationId");
+
+ b.ToTable("UserConfirmations");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.Comment", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("AuthorId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DraftContent")
+ .HasMaxLength(2048)
+ .HasColumnType("character varying(2048)");
+
+ b.Property("EditedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("EditedByAdminId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("IsApproved")
+ .HasColumnType("boolean");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("LiftedElementId")
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.Property("ParentId")
+ .HasColumnType("integer");
+
+ b.Property("Score")
+ .HasColumnType("integer");
+
+ b.Property("TargetId")
+ .HasColumnType("integer");
+
+ b.Property("TargetType")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuthorId");
+
+ b.HasIndex("ParentId");
+
+ b.ToTable("Comments");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.CommentVote", b =>
+ {
+ b.Property("CommentId")
+ .HasColumnType("integer");
+
+ b.Property("UserId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("Value")
+ .HasColumnType("smallint");
+
+ b.Property("VotedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("CommentId", "UserId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("CommentVotes");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.Guide", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("ActiveVersionId")
+ .HasColumnType("integer");
+
+ b.Property("AuthorId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("DraftVersionId")
+ .HasColumnType("integer");
+
+ b.Property("IconSkyblockId")
+ .HasMaxLength(256)
+ .HasColumnType("character varying(256)");
+
+ b.Property("IsDeleted")
+ .HasColumnType("boolean");
+
+ b.Property("RejectionReason")
+ .HasMaxLength(1000)
+ .HasColumnType("character varying(1000)");
+
+ b.Property("Score")
+ .HasColumnType("integer");
+
+ b.Property("Status")
+ .HasColumnType("integer");
+
+ b.Property("Type")
+ .HasColumnType("integer");
+
+ b.Property("UpdatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("ViewCount")
+ .HasColumnType("integer");
+
+ b.HasKey("Id");
+
+ b.HasIndex("ActiveVersionId")
+ .IsUnique();
+
+ b.HasIndex("AuthorId");
+
+ b.HasIndex("DraftVersionId")
+ .IsUnique();
+
+ b.ToTable("Guides");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.GuideBookmark", b =>
+ {
+ b.Property("UserId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("GuideId")
+ .HasColumnType("integer");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("UserId", "GuideId");
+
+ b.HasIndex("GuideId");
+
+ b.ToTable("GuideBookmarks");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.GuideTag", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Category")
+ .IsRequired()
+ .HasMaxLength(32)
+ .HasColumnType("character varying(32)");
+
+ b.Property("HexColor")
+ .IsRequired()
+ .HasMaxLength(7)
+ .HasColumnType("character varying(7)");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.HasKey("Id");
+
+ b.ToTable("GuideTags");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.GuideTagMapping", b =>
+ {
+ b.Property("GuideId")
+ .HasColumnType("integer");
+
+ b.Property("TagId")
+ .HasColumnType("integer");
+
+ b.HasKey("GuideId", "TagId");
+
+ b.HasIndex("TagId");
+
+ b.ToTable("GuideTagMapping");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.GuideVersion", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("GuideId")
+ .HasColumnType("integer");
+
+ b.Property("IconItemName")
+ .HasColumnType("text");
+
+ b.Property("MarkdownContent")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("RichBlocks")
+ .HasColumnType("jsonb");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("character varying(128)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("GuideId");
+
+ b.ToTable("GuideVersions");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Guides.Models.GuideVote", b =>
+ {
+ b.Property("GuideId")
+ .HasColumnType("integer");
+
+ b.Property("UserId")
+ .HasColumnType("numeric(20,0)");
+
+ b.Property("Value")
+ .HasColumnType("smallint");
+
+ b.Property("VotedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("GuideId", "UserId");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("GuideVotes");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Models.HypixelGuild", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("CreatedAt")
+ .HasColumnType("bigint");
+
+ b.Property("Deleted")
+ .HasColumnType("boolean");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Exp")
+ .HasColumnType("bigint");
+
+ b.Property>("GameExp")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property("LastUpdated")
+ .HasColumnType("bigint");
+
+ b.Property("MemberCount")
+ .HasColumnType("integer");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("NameLower")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.PrimitiveCollection("PreferredGames")
+ .HasColumnType("jsonb");
+
+ b.Property("Public")
+ .HasColumnType("boolean");
+
+ b.Property("PubliclyListed")
+ .HasColumnType("boolean");
+
+ b.Property>("Ranks")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property("Tag")
+ .HasColumnType("text");
+
+ b.Property("TagColor")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("MemberCount");
+
+ b.HasIndex("NameLower");
+
+ b.ToTable("HypixelGuilds");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Models.HypixelGuildLeaderboardResult", b =>
+ {
+ b.Property("Amount")
+ .HasColumnType("double precision");
+
+ b.Property("CreatedAt")
+ .HasColumnType("bigint");
+
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.Property("LastUpdated")
+ .HasColumnType("bigint");
+
+ b.Property("MemberCount")
+ .HasColumnType("integer");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Tag")
+ .HasColumnType("text");
+
+ b.Property("TagColor")
+ .HasColumnType("text");
+
+ b.ToTable("HypixelGuildLeaderboardResult", null, t =>
+ {
+ t.ExcludeFromMigrations();
+ });
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Models.HypixelGuildMember", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property("Active")
+ .HasColumnType("boolean");
+
+ b.Property("GuildId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("JoinedAt")
+ .HasColumnType("bigint");
+
+ b.Property("LeftAt")
+ .HasColumnType("bigint");
+
+ b.Property("PlayerUuid")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("QuestParticipation")
+ .HasColumnType("integer");
+
+ b.Property("Rank")
+ .HasColumnType("text");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Active");
+
+ b.HasIndex("PlayerUuid");
+
+ b.HasIndex("GuildId", "Active");
+
+ b.HasIndex("GuildId", "PlayerUuid")
+ .IsUnique();
+
+ b.ToTable("HypixelGuildMembers");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Models.HypixelGuildMemberExp", b =>
+ {
+ b.Property("GuildMemberId")
+ .HasColumnType("bigint");
+
+ b.Property("Day")
+ .HasColumnType("date");
+
+ b.Property("Xp")
+ .HasColumnType("integer");
+
+ b.HasKey("GuildMemberId", "Day");
+
+ b.HasIndex("Day")
+ .IsDescending();
+
+ b.HasIndex("GuildMemberId");
+
+ b.ToTable("HypixelGuildMemberExps");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Models.HypixelGuildStats", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("bigint");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id"));
+
+ b.Property>("Collections")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property("GuildId")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("IsLatest")
+ .HasColumnType("boolean");
+
+ b.Property("MemberCount")
+ .HasColumnType("integer");
+
+ b.Property("RecordedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property>("Skills")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.HasKey("Id");
+
+ b.HasIndex("RecordedAt");
+
+ b.HasIndex("GuildId", "IsLatest")
+ .HasFilter("\"IsLatest\" = true");
+
+ b.ToTable("HypixelGuildStats");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Services.GuildIdResult", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("text");
+
+ b.ToTable("GuildIdResult", null, t =>
+ {
+ t.ExcludeFromMigrations();
+ });
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.HypixelGuilds.Services.GuildRankResult", b =>
+ {
+ b.Property("Amount")
+ .HasColumnType("double precision");
+
+ b.Property("Rank")
+ .HasColumnType("integer");
+
+ b.ToTable("GuildRankResult", null, t =>
+ {
+ t.ExcludeFromMigrations();
+ });
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Images.Models.Image", b =>
+ {
+ b.Property("Id")
+ .HasMaxLength(48)
+ .HasColumnType("character varying(48)");
+
+ b.Property("CreatedAt")
+ .HasColumnType("timestamp with time zone");
+
+ b.Property("Description")
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("Hash")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.Property>("Metadata")
+ .IsRequired()
+ .HasColumnType("jsonb");
+
+ b.Property("Order")
+ .HasColumnType("integer");
+
+ b.Property("Path")
+ .IsRequired()
+ .HasMaxLength(512)
+ .HasColumnType("character varying(512)");
+
+ b.Property("Title")
+ .HasMaxLength(64)
+ .HasColumnType("character varying(64)");
+
+ b.HasKey("Id");
+
+ b.HasIndex("Hash");
+
+ b.HasIndex("Path");
+
+ b.ToTable("Images");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Leaderboards.Models.Leaderboard", b =>
+ {
+ b.Property("LeaderboardId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaderboardId"));
+
+ b.Property("EndDate")
+ .HasColumnType("date");
+
+ b.Property("EntryType")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("IconId")
+ .HasColumnType("character varying(48)");
+
+ b.Property("IntervalType")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("MinimumScore")
+ .HasColumnType("numeric");
+
+ b.Property("Property")
+ .HasColumnType("text");
+
+ b.Property("ScoreDataType")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("ShortTitle")
+ .HasColumnType("text");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("StartDate")
+ .HasColumnType("date");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(200)
+ .HasColumnType("character varying(200)");
+
+ b.HasKey("LeaderboardId");
+
+ b.HasIndex("IconId");
+
+ b.HasIndex("Slug")
+ .IsUnique();
+
+ b.ToTable("Leaderboards");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Leaderboards.Models.LeaderboardEntry", b =>
+ {
+ b.Property("LeaderboardEntryId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaderboardEntryId"));
+
+ b.Property("InitialScore")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("decimal(24, 4)")
+ .HasDefaultValue(0m);
+
+ b.Property("IntervalIdentifier")
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("IsRemoved")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("boolean")
+ .HasDefaultValue(false);
+
+ b.Property("LeaderboardId")
+ .HasColumnType("integer");
+
+ b.Property("ProfileId")
+ .HasColumnType("text");
+
+ b.Property("ProfileMemberId")
+ .HasColumnType("uuid");
+
+ b.Property("ProfileType")
+ .HasMaxLength(100)
+ .HasColumnType("character varying(100)");
+
+ b.Property("Score")
+ .HasColumnType("decimal(24, 4)");
+
+ b.HasKey("LeaderboardEntryId");
+
+ b.HasIndex("IsRemoved");
+
+ b.HasIndex("ProfileId");
+
+ b.HasIndex("ProfileMemberId");
+
+ b.HasIndex("LeaderboardId", "IntervalIdentifier", "Score")
+ .IsDescending(false, false, true);
+
+ b.HasIndex("ProfileType", "LeaderboardId", "IntervalIdentifier");
+
+ b.HasIndex("LeaderboardId", "IsRemoved", "Score", "LeaderboardEntryId")
+ .IsDescending(false, false, true, true)
+ .HasDatabaseName("IX_LeaderboardEntries_Rank_Subquery_AllTime")
+ .HasFilter("\"IntervalIdentifier\" IS NULL");
+
+ b.HasIndex("LeaderboardId", "IsRemoved", "IntervalIdentifier", "Score", "LeaderboardEntryId")
+ .IsDescending(false, false, false, true, true)
+ .HasDatabaseName("IX_LeaderboardEntries_Ranks_Subquery");
+
+ b.ToTable("LeaderboardEntries");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Leaderboards.Models.LeaderboardRanksQueryResult", b =>
+ {
+ b.Property("InitialScore")
+ .HasColumnType("numeric");
+
+ b.Property("IntervalIdentifier")
+ .HasColumnType("text");
+
+ b.Property("Rank")
+ .HasColumnType("bigint");
+
+ b.Property("Score")
+ .HasColumnType("numeric");
+
+ b.Property("ScoreDataType")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("ShortTitle")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Slug")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasColumnType("text");
+
+ b.ToTable("LeaderboardRanksQueryResult", null, t =>
+ {
+ t.ExcludeFromMigrations();
+ });
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Leaderboards.Models.LeaderboardSnapshot", b =>
+ {
+ b.Property("LeaderboardSnapshotId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("LeaderboardSnapshotId"));
+
+ b.Property("IntervalIdentifier")
+ .IsRequired()
+ .HasMaxLength(50)
+ .HasColumnType("character varying(50)");
+
+ b.Property("LeaderboardId")
+ .HasColumnType("integer");
+
+ b.Property("SnapshotTimestamp")
+ .HasColumnType("timestamp with time zone");
+
+ b.HasKey("LeaderboardSnapshotId");
+
+ b.HasIndex("LeaderboardId", "IntervalIdentifier");
+
+ b.HasIndex(new[] { "LeaderboardId", "SnapshotTimestamp", "IntervalIdentifier" }, "IX_LeaderboardSnapshots_Definition_Timestamp_Interval")
+ .IsUnique();
+
+ b.ToTable("LeaderboardSnapshots");
+ });
+
+ modelBuilder.Entity("EliteAPI.Features.Leaderboards.Models.LeaderboardSnapshotEntry", b =>
+ {
+ b.Property("LeaderboardSnapshotEntryId")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("integer");
+
+ NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property