From 7237ced70df5080ceba9a099229214274a62b579 Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 29 Oct 2025 15:45:17 -0500 Subject: [PATCH] Fix EF Core configuration and database migration - Updated GameDbContext with explicit foreign key constraint names - Fixed migrations assembly configuration in Program.cs - Resolved shadow property warnings for CombatLog and PurchaseLog relationships - Added proper entity configurations for AllianceInvitation and AllianceRole - Successfully created clean database schema with all tables and indexes - Ready for field interception combat system and alliance coalition features --- ShadowedRealmsMobile/src/server/.env | 2 +- .../20251028205529_InitialCreate.Designer.cs | 1801 ++++++++++++++++ .../20251028205529_InitialCreate.cs | 1033 +++++++++ .../Migrations/GameDbContextModelSnapshot.cs | 1798 ++++++++++++++++ .../src/server/ShadowedRealms.API/Program.cs | 9 +- .../ShadowedRealms.API.csproj | 5 + .../Contexts/GameDbContext.cs | 253 ++- ...251029203255_FixEFCoreWarnings.Designer.cs | 1890 +++++++++++++++++ .../20251029203255_FixEFCoreWarnings.cs | 1086 ++++++++++ .../Migrations/GameDbContextModelSnapshot.cs | 1887 ++++++++++++++++ 10 files changed, 9732 insertions(+), 32 deletions(-) create mode 100644 ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.Designer.cs create mode 100644 ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.cs create mode 100644 ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/GameDbContextModelSnapshot.cs create mode 100644 ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.Designer.cs create mode 100644 ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.cs create mode 100644 ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/GameDbContextModelSnapshot.cs diff --git a/ShadowedRealmsMobile/src/server/.env b/ShadowedRealmsMobile/src/server/.env index 02fd9b6..e5d0ea0 100644 --- a/ShadowedRealmsMobile/src/server/.env +++ b/ShadowedRealmsMobile/src/server/.env @@ -8,7 +8,7 @@ POSTGRES_HOST=209.25.140.218 POSTGRES_DB=ShadowedRealms POSTGRES_USER=gameserver -POSTGRES_PASSWORD=w92oOUPGAR/ZRJaDynLQIq07aFzvTQ6tQzOJsXMStXE= +POSTGRES_PASSWORD=HakeCeStdE6N5jtP/wokS7ur9KNTDKZf3cOPtYqjwiQ= # =============================== # REDIS CONFIGURATION diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.Designer.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.Designer.cs new file mode 100644 index 0000000..ef7bfea --- /dev/null +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.Designer.cs @@ -0,0 +1,1801 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using ShadowedRealms.Data.Contexts; + +#nullable disable + +namespace ShadowedRealms.API.Migrations +{ + [DbContext(typeof(GameDbContext))] + [Migration("20251028205529_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("Role_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Logins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("Player_Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Player_Tokens", (string)null); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptsCoalitionInvites") + .HasColumnType("boolean"); + + b.Property("CoalitionReputationScore") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentCoalitionId") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("EconomicGatheringResearch") + .HasColumnType("integer"); + + b.Property("EconomicProductionResearch") + .HasColumnType("integer"); + + b.Property("EconomicStorageResearch") + .HasColumnType("integer"); + + b.Property("EconomicTaxationResearch") + .HasColumnType("integer"); + + b.Property("EconomicTradeResearch") + .HasColumnType("integer"); + + b.Property("ExperiencePoints") + .HasColumnType("bigint"); + + b.Property("FortressLevel") + .HasColumnType("integer"); + + b.Property("FortressX") + .HasColumnType("integer"); + + b.Property("FortressY") + .HasColumnType("integer"); + + b.Property("HasTerritory") + .HasColumnType("boolean"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsOpenToJoin") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKParticipations") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastKvKParticipation") + .HasColumnType("timestamp with time zone"); + + b.Property("LeaderId") + .HasColumnType("integer"); + + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("MaxMembers") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(50); + + b.Property("MilitaryAttackResearch") + .HasColumnType("integer"); + + b.Property("MilitaryCapacityResearch") + .HasColumnType("integer"); + + b.Property("MilitaryDefenseResearch") + .HasColumnType("integer"); + + b.Property("MilitaryHealthResearch") + .HasColumnType("integer"); + + b.Property("MilitarySpeedResearch") + .HasColumnType("integer"); + + b.Property("MinCastleLevelToJoin") + .HasColumnType("integer"); + + b.Property("MinPowerToJoin") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("RequireApproval") + .HasColumnType("boolean"); + + b.Property("ResourceBuildingCount") + .HasColumnType("integer"); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesShared") + .HasColumnType("bigint"); + + b.Property("Tag") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("character varying(5)"); + + b.Property("TechnologyConstructionResearch") + .HasColumnType("integer"); + + b.Property("TechnologyHealingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyResearchResearch") + .HasColumnType("integer"); + + b.Property("TechnologyTrainingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyUpgradeResearch") + .HasColumnType("integer"); + + b.Property("TotalDeaths") + .HasColumnType("bigint"); + + b.Property("TotalKills") + .HasColumnType("bigint"); + + b.Property("TowerCount") + .HasColumnType("integer"); + + b.Property("TreasuryFood") + .HasColumnType("bigint"); + + b.Property("TreasuryIron") + .HasColumnType("bigint"); + + b.Property("TreasuryMithril") + .HasColumnType("bigint"); + + b.Property("TreasurySilver") + .HasColumnType("bigint"); + + b.Property("TreasuryWood") + .HasColumnType("bigint"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("KingdomId"); + + b.HasIndex("LeaderId") + .IsUnique(); + + b.HasIndex("Name"); + + b.HasIndex("Power"); + + b.HasIndex("Tag"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Alliances_Kingdom_Power"); + + b.ToTable("Alliances"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("InvitedById") + .HasColumnType("integer"); + + b.Property("IsAccepted") + .HasColumnType("boolean"); + + b.Property("IsRejected") + .HasColumnType("boolean"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("InvitedById"); + + b.HasIndex("PlayerId"); + + b.ToTable("AllianceInvitation"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AssignedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("AssignedById") + .HasColumnType("integer"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("Rank") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("AssignedById"); + + b.HasIndex("PlayerId"); + + b.ToTable("AllianceRole"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttackerAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceId") + .HasColumnType("integer"); + + b.Property("AttackerBowmenAfter") + .HasColumnType("bigint"); + + b.Property("AttackerBowmenBefore") + .HasColumnType("bigint"); + + b.Property("AttackerCasualties") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerDragonBonus") + .HasColumnType("double precision"); + + b.Property("AttackerDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("AttackerHadDragon") + .HasColumnType("boolean"); + + b.Property("AttackerHighestTroopTier") + .HasColumnType("integer"); + + b.Property("AttackerInfantryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerInfantryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerPlayerId") + .HasColumnType("integer"); + + b.Property("AttackerPlayerId1") + .HasColumnType("integer"); + + b.Property("AttackerPowerBefore") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeAfter") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeBefore") + .HasColumnType("bigint"); + + b.Property("AttackerWoundedTroops") + .HasColumnType("bigint"); + + b.Property("BattleNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BattleX") + .HasColumnType("integer"); + + b.Property("BattleY") + .HasColumnType("integer"); + + b.Property("CoalitionId") + .HasColumnType("integer"); + + b.Property("CombatType") + .HasColumnType("integer"); + + b.Property("DefenderAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceId") + .HasColumnType("integer"); + + b.Property("DefenderBowmenAfter") + .HasColumnType("bigint"); + + b.Property("DefenderBowmenBefore") + .HasColumnType("bigint"); + + b.Property("DefenderCasualties") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderDragonBonus") + .HasColumnType("double precision"); + + b.Property("DefenderDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("DefenderHadDragon") + .HasColumnType("boolean"); + + b.Property("DefenderHighestTroopTier") + .HasColumnType("integer"); + + b.Property("DefenderInfantryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderInfantryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderPlayerId") + .HasColumnType("integer"); + + b.Property("DefenderPlayerId1") + .HasColumnType("integer"); + + b.Property("DefenderPowerBefore") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeAfter") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeBefore") + .HasColumnType("bigint"); + + b.Property("DefenderWoundedTroops") + .HasColumnType("bigint"); + + b.Property("DetailedBattleReport") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("FoodTransferred") + .HasColumnType("bigint"); + + b.Property("ForestSpeedReduction") + .HasColumnType("double precision"); + + b.Property("InterceptionType") + .HasColumnType("integer"); + + b.Property("InterceptorPlayerId") + .HasColumnType("integer"); + + b.Property("IronTransferred") + .HasColumnType("bigint"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("KvKEventId") + .HasColumnType("integer"); + + b.Property("MarchArrivalTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MarchDurationSeconds") + .HasColumnType("integer"); + + b.Property("MarchStartTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MithrilTransferred") + .HasColumnType("bigint"); + + b.Property("Result") + .HasColumnType("integer"); + + b.Property("SilverTransferred") + .HasColumnType("bigint"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("UsedSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("WasFieldInterception") + .HasColumnType("boolean"); + + b.Property("WasInForestZone") + .HasColumnType("boolean"); + + b.Property("WasKvKBattle") + .HasColumnType("boolean"); + + b.Property("WoodTransferred") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AttackerAllianceId"); + + b.HasIndex("AttackerPlayerId"); + + b.HasIndex("AttackerPlayerId1"); + + b.HasIndex("DefenderAllianceId"); + + b.HasIndex("DefenderPlayerId"); + + b.HasIndex("DefenderPlayerId1"); + + b.HasIndex("InterceptorPlayerId"); + + b.HasIndex("KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("Timestamp"); + + b.HasIndex("KingdomId", "Timestamp") + .HasDatabaseName("IX_CombatLogs_Kingdom_Time"); + + b.ToTable("CombatLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptingNewPlayers") + .HasColumnType("boolean"); + + b.Property("AutoKickInactivePlayers") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("CurrentPowerRank") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EnableTaxSystem") + .HasColumnType("boolean"); + + b.Property("InactivityKickDays") + .HasColumnType("integer"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMerger") + .HasColumnType("boolean"); + + b.Property("IsInKvK") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKDraws") + .HasColumnType("integer"); + + b.Property("KvKHostAllianceId") + .HasColumnType("integer"); + + b.Property("KvKLosses") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastActivity") + .HasColumnType("timestamp with time zone"); + + b.Property("LastKvKDate") + .HasColumnType("timestamp with time zone"); + + b.Property("MaxPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1500); + + b.Property("MergerAvailableDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Number") + .HasColumnType("integer"); + + b.Property("TaxRate") + .HasColumnType("numeric"); + + b.Property("TotalPower") + .HasColumnType("bigint"); + + b.Property("TotalTaxCollected") + .HasColumnType("numeric"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.HasIndex("Number") + .IsUnique(); + + b.ToTable("Kingdoms"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptAllianceInvites") + .HasColumnType("boolean"); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AttacksLost") + .HasColumnType("bigint"); + + b.Property("AttacksWon") + .HasColumnType("bigint"); + + b.Property("AutoUseSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("Biography") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BowmenT1") + .HasColumnType("bigint"); + + b.Property("BowmenT10") + .HasColumnType("bigint"); + + b.Property("BowmenT11") + .HasColumnType("bigint"); + + b.Property("BowmenT12") + .HasColumnType("bigint"); + + b.Property("BowmenT13") + .HasColumnType("bigint"); + + b.Property("BowmenT2") + .HasColumnType("bigint"); + + b.Property("BowmenT3") + .HasColumnType("bigint"); + + b.Property("BowmenT4") + .HasColumnType("bigint"); + + b.Property("BowmenT5") + .HasColumnType("bigint"); + + b.Property("CastleLevel") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("CavalryT1") + .HasColumnType("bigint"); + + b.Property("CavalryT10") + .HasColumnType("bigint"); + + b.Property("CavalryT11") + .HasColumnType("bigint"); + + b.Property("CavalryT12") + .HasColumnType("bigint"); + + b.Property("CavalryT13") + .HasColumnType("bigint"); + + b.Property("CavalryT2") + .HasColumnType("bigint"); + + b.Property("CavalryT3") + .HasColumnType("bigint"); + + b.Property("CavalryT4") + .HasColumnType("bigint"); + + b.Property("CavalryT5") + .HasColumnType("bigint"); + + b.Property("CoordinateX") + .HasColumnType("integer"); + + b.Property("CoordinateY") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("DefensesLost") + .HasColumnType("bigint"); + + b.Property("DefensesWon") + .HasColumnType("bigint"); + + b.Property("DragonExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("EnablePushNotifications") + .HasColumnType("boolean"); + + b.Property("Food") + .HasColumnType("bigint"); + + b.Property("FoodProtected") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("integer"); + + b.Property("HasActiveDragon") + .HasColumnType("boolean"); + + b.Property("InfantryT1") + .HasColumnType("bigint"); + + b.Property("InfantryT10") + .HasColumnType("bigint"); + + b.Property("InfantryT11") + .HasColumnType("bigint"); + + b.Property("InfantryT12") + .HasColumnType("bigint"); + + b.Property("InfantryT13") + .HasColumnType("bigint"); + + b.Property("InfantryT2") + .HasColumnType("bigint"); + + b.Property("InfantryT3") + .HasColumnType("bigint"); + + b.Property("InfantryT4") + .HasColumnType("bigint"); + + b.Property("InfantryT5") + .HasColumnType("bigint"); + + b.Property("Iron") + .HasColumnType("bigint"); + + b.Property("IronProtected") + .HasColumnType("bigint"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("LastActiveAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("Mithril") + .HasColumnType("bigint"); + + b.Property("MithrilProtected") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesRaided") + .HasColumnType("bigint"); + + b.Property("ShowOnlineStatus") + .HasColumnType("boolean"); + + b.Property("SiegeT1") + .HasColumnType("bigint"); + + b.Property("SiegeT10") + .HasColumnType("bigint"); + + b.Property("SiegeT11") + .HasColumnType("bigint"); + + b.Property("SiegeT12") + .HasColumnType("bigint"); + + b.Property("SiegeT13") + .HasColumnType("bigint"); + + b.Property("SiegeT2") + .HasColumnType("bigint"); + + b.Property("SiegeT3") + .HasColumnType("bigint"); + + b.Property("SiegeT4") + .HasColumnType("bigint"); + + b.Property("SiegeT5") + .HasColumnType("bigint"); + + b.Property("Silver") + .HasColumnType("bigint"); + + b.Property("SilverProtected") + .HasColumnType("bigint"); + + b.Property("TroopsKilled") + .HasColumnType("bigint"); + + b.Property("TroopsLost") + .HasColumnType("bigint"); + + b.Property("VipExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("VipLevel") + .HasColumnType("integer"); + + b.Property("Wood") + .HasColumnType("bigint"); + + b.Property("WoodProtected") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("KingdomId"); + + b.HasIndex("Name"); + + b.HasIndex("Power"); + + b.HasIndex("KingdomId", "AllianceId") + .HasDatabaseName("IX_Players_Kingdom_Alliance"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Players_Kingdom_Power"); + + b.ToTable("Players"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("BoostHours") + .HasColumnType("integer"); + + b.Property("BoostPercentage") + .HasColumnType("integer"); + + b.Property("BundleContents") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BundleDiscountPercentage") + .HasColumnType("double precision"); + + b.Property("CampaignId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ChargebackAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputeDeadline") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputed") + .HasColumnType("boolean"); + + b.Property("ChargebackFee") + .HasColumnType("numeric"); + + b.Property("ChargebackPenalty") + .HasColumnType("numeric"); + + b.Property("ChargebackReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("DaysSinceLastPurchase") + .HasColumnType("integer"); + + b.Property("DetailedPurchaseData") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("DeviceInfo") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DisputeStatus") + .HasColumnType("integer"); + + b.Property("DragonDaysAdded") + .HasColumnType("integer"); + + b.Property("DragonSkillsUnlocked") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("DragonType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("FoodReceived") + .HasColumnType("bigint"); + + b.Property("FraudNotes") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("FraudReason") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("FraudScore") + .HasColumnType("integer"); + + b.Property("GoldBalanceAfter") + .HasColumnType("integer"); + + b.Property("GoldBalanceBefore") + .HasColumnType("integer"); + + b.Property("GoldPurchased") + .HasColumnType("integer"); + + b.Property("GoldSpent") + .HasColumnType("integer"); + + b.Property("HasSkillBasedAlternative") + .HasColumnType("boolean"); + + b.Property("IPAddress") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("IronReceived") + .HasColumnType("bigint"); + + b.Property("IsBundle") + .HasColumnType("boolean"); + + b.Property("IsChargedBack") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsConstructionBoost") + .HasColumnType("boolean"); + + b.Property("IsDragonPurchase") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMonthlyReward") + .HasColumnType("boolean"); + + b.Property("IsEligibleForYearlyReward") + .HasColumnType("boolean"); + + b.Property("IsFirstMonthlyPurchase") + .HasColumnType("boolean"); + + b.Property("IsFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsFraudSuspected") + .HasColumnType("boolean"); + + b.Property("IsHighRiskTransaction") + .HasColumnType("boolean"); + + b.Property("IsNewDevicePurchase") + .HasColumnType("boolean"); + + b.Property("IsRefunded") + .HasColumnType("boolean"); + + b.Property("IsResearchBoost") + .HasColumnType("boolean"); + + b.Property("IsResourcePackage") + .HasColumnType("boolean"); + + b.Property("IsSpeedBoostPurchase") + .HasColumnType("boolean"); + + b.Property("IsStealthPurchase") + .HasColumnType("boolean"); + + b.Property("IsSuspicious") + .HasColumnType("boolean"); + + b.Property("IsTrainingBoost") + .HasColumnType("boolean"); + + b.Property("IsVelocityFlagged") + .HasColumnType("boolean"); + + b.Property("IsVipPurchase") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("LifetimePurchaseCount") + .HasColumnType("integer"); + + b.Property("LifetimeSpendingAfter") + .HasColumnType("numeric"); + + b.Property("LifetimeSpendingBefore") + .HasColumnType("numeric"); + + b.Property("MinutesFromRegistration") + .HasColumnType("integer"); + + b.Property("MithrilReceived") + .HasColumnType("bigint"); + + b.Property("MonthlyPurchaseCount") + .HasColumnType("integer"); + + b.Property("MonthlySpendingAfter") + .HasColumnType("numeric"); + + b.Property("MonthlySpendingBefore") + .HasColumnType("numeric"); + + b.Property("NetRevenue") + .HasColumnType("numeric"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("Platform") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("PlatformFee") + .HasColumnType("numeric"); + + b.Property("PlatformReceiptData") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("PlatformTransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PlatformUserId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("PlayerId1") + .HasColumnType("integer"); + + b.Property("ProcessedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ProductName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PromotionCode") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PurchaseDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("PurchaseNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PurchaseType") + .HasColumnType("integer"); + + b.Property("PurchasesInLast24Hours") + .HasColumnType("integer"); + + b.Property("RefundAmount") + .HasColumnType("numeric"); + + b.Property("RefundDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RefundReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("RefundedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RequiresManualReview") + .HasColumnType("boolean"); + + b.Property("SecretSpendingTierAfter") + .HasColumnType("integer"); + + b.Property("SecretSpendingTierBefore") + .HasColumnType("integer"); + + b.Property("SilverReceived") + .HasColumnType("bigint"); + + b.Property("SkillAlternativeDescription") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SkillAlternativeUsed") + .HasColumnType("double precision"); + + b.Property("SpeedBoostHours") + .HasColumnType("integer"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("SpeedBoostQuantity") + .HasColumnType("integer"); + + b.Property("SpendingInLast24Hours") + .HasColumnType("numeric"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StealthType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("StealthUsesAdded") + .HasColumnType("integer"); + + b.Property("TaxAmount") + .HasColumnType("numeric"); + + b.Property("TimeInvestmentHours") + .HasColumnType("numeric"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("TriggeredVipMilestone") + .HasColumnType("boolean"); + + b.Property("UnlockedNewSecretTier") + .HasColumnType("boolean"); + + b.Property("UserAgent") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("VipDaysAdded") + .HasColumnType("integer"); + + b.Property("VipLevelAfter") + .HasColumnType("integer"); + + b.Property("VipLevelBefore") + .HasColumnType("integer"); + + b.Property("VipMilestoneReached") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("VipPointsAfter") + .HasColumnType("integer"); + + b.Property("VipPointsBefore") + .HasColumnType("integer"); + + b.Property("VipPointsEarned") + .HasColumnType("integer"); + + b.Property("WasChargeback") + .HasColumnType("boolean"); + + b.Property("WasRefunded") + .HasColumnType("boolean"); + + b.Property("WoodReceived") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("PlayerId"); + + b.HasIndex("PlayerId1"); + + b.HasIndex("PurchaseDate"); + + b.HasIndex("KingdomId", "PurchaseDate") + .HasDatabaseName("IX_PurchaseLogs_Kingdom_Time"); + + b.ToTable("PurchaseLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Data.Contexts.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LastLoginAt") + .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("PlayerId") + .HasColumnType("integer"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Players_Auth", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Alliances") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Leader") + .WithOne() + .HasForeignKey("ShadowedRealms.Core.Models.Alliance.Alliance", "LeaderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Kingdom"); + + b.Navigation("Leader"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("PendingInvitations") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InvitedBy") + .WithMany() + .HasForeignKey("InvitedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("InvitedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Roles") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AssignedBy") + .WithMany() + .HasForeignKey("AssignedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("AssignedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "AttackerAlliance") + .WithMany() + .HasForeignKey("AttackerAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("AttackerPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AttackerPlayer") + .WithMany() + .HasForeignKey("AttackerPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "DefenderAlliance") + .WithMany() + .HasForeignKey("DefenderAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("DefenderPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "DefenderPlayer") + .WithMany() + .HasForeignKey("DefenderPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InterceptorPlayer") + .WithMany() + .HasForeignKey("InterceptorPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AttackerAlliance"); + + b.Navigation("AttackerPlayer"); + + b.Navigation("DefenderAlliance"); + + b.Navigation("DefenderPlayer"); + + b.Navigation("InterceptorPlayer"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Members") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Players") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany() + .HasForeignKey("AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Navigation("Members"); + + b.Navigation("PendingInvitations"); + + b.Navigation("Roles"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Navigation("Alliances"); + + b.Navigation("Players"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.cs new file mode 100644 index 0000000..875166e --- /dev/null +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/20251028205529_InitialCreate.cs @@ -0,0 +1,1033 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace ShadowedRealms.API.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Kingdoms", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Number = table.Column(type: "integer", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + MaxPopulation = table.Column(type: "integer", nullable: false, defaultValue: 1500), + CurrentPopulation = table.Column(type: "integer", nullable: false, defaultValue: 0), + TotalPower = table.Column(type: "bigint", nullable: false), + LastKvKDate = table.Column(type: "timestamp with time zone", nullable: true), + KvKWins = table.Column(type: "integer", nullable: false), + KvKLosses = table.Column(type: "integer", nullable: false), + KvKDraws = table.Column(type: "integer", nullable: false), + IsEligibleForKvK = table.Column(type: "boolean", nullable: false), + AcceptingNewPlayers = table.Column(type: "boolean", nullable: false), + MergerAvailableDate = table.Column(type: "timestamp with time zone", nullable: true), + IsEligibleForMerger = table.Column(type: "boolean", nullable: false), + Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + WelcomeMessage = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + AutoKickInactivePlayers = table.Column(type: "boolean", nullable: false), + InactivityKickDays = table.Column(type: "integer", nullable: false), + EnableTaxSystem = table.Column(type: "boolean", nullable: false), + TaxRate = table.Column(type: "numeric", nullable: false), + LastActivity = table.Column(type: "timestamp with time zone", nullable: false), + TotalTaxCollected = table.Column(type: "numeric", nullable: false), + IsInKvK = table.Column(type: "boolean", nullable: false), + KvKHostAllianceId = table.Column(type: "integer", nullable: true), + CurrentPowerRank = table.Column(type: "integer", nullable: false), + KingdomId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Kingdoms", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Players_Auth", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PlayerId = table.Column(type: "integer", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + LastLoginAt = table.Column(type: "timestamp with time zone", nullable: false), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Players_Auth", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Roles", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Roles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Player_Claims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "integer", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Claims", x => x.Id); + table.ForeignKey( + name: "FK_Player_Claims_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Player_Logins", + columns: table => new + { + LoginProvider = table.Column(type: "text", nullable: false), + ProviderKey = table.Column(type: "text", nullable: false), + ProviderDisplayName = table.Column(type: "text", nullable: true), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Logins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_Player_Logins_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Player_Tokens", + columns: table => new + { + UserId = table.Column(type: "integer", nullable: false), + LoginProvider = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Tokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_Player_Tokens_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Player_Roles", + columns: table => new + { + UserId = table.Column(type: "integer", nullable: false), + RoleId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Roles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_Player_Roles_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Player_Roles_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Role_Claims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + RoleId = table.Column(type: "integer", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Role_Claims", x => x.Id); + table.ForeignKey( + name: "FK_Role_Claims_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AllianceInvitation", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AllianceId = table.Column(type: "integer", nullable: false), + PlayerId = table.Column(type: "integer", nullable: false), + InvitedById = table.Column(type: "integer", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), + IsAccepted = table.Column(type: "boolean", nullable: false), + IsRejected = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AllianceInvitation", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AllianceRole", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AllianceId = table.Column(type: "integer", nullable: false), + PlayerId = table.Column(type: "integer", nullable: false), + Rank = table.Column(type: "integer", nullable: false), + AssignedAt = table.Column(type: "timestamp with time zone", nullable: false), + AssignedById = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AllianceRole", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Alliances", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Tag = table.Column(type: "character varying(5)", maxLength: 5, nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + LeaderId = table.Column(type: "integer", nullable: false), + Level = table.Column(type: "integer", nullable: false, defaultValue: 1), + Power = table.Column(type: "bigint", nullable: false, defaultValue: 0L), + ExperiencePoints = table.Column(type: "bigint", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + MaxMembers = table.Column(type: "integer", nullable: false, defaultValue: 50), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + WelcomeMessage = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + IsOpenToJoin = table.Column(type: "boolean", nullable: false), + RequireApproval = table.Column(type: "boolean", nullable: false), + MinCastleLevelToJoin = table.Column(type: "integer", nullable: false), + MinPowerToJoin = table.Column(type: "bigint", nullable: false), + FortressX = table.Column(type: "integer", nullable: false), + FortressY = table.Column(type: "integer", nullable: false), + FortressLevel = table.Column(type: "integer", nullable: false), + TowerCount = table.Column(type: "integer", nullable: false), + ResourceBuildingCount = table.Column(type: "integer", nullable: false), + HasTerritory = table.Column(type: "boolean", nullable: false), + MilitaryAttackResearch = table.Column(type: "integer", nullable: false), + MilitaryDefenseResearch = table.Column(type: "integer", nullable: false), + MilitaryHealthResearch = table.Column(type: "integer", nullable: false), + MilitarySpeedResearch = table.Column(type: "integer", nullable: false), + MilitaryCapacityResearch = table.Column(type: "integer", nullable: false), + EconomicGatheringResearch = table.Column(type: "integer", nullable: false), + EconomicStorageResearch = table.Column(type: "integer", nullable: false), + EconomicTradeResearch = table.Column(type: "integer", nullable: false), + EconomicProductionResearch = table.Column(type: "integer", nullable: false), + EconomicTaxationResearch = table.Column(type: "integer", nullable: false), + TechnologyConstructionResearch = table.Column(type: "integer", nullable: false), + TechnologyUpgradeResearch = table.Column(type: "integer", nullable: false), + TechnologyTrainingResearch = table.Column(type: "integer", nullable: false), + TechnologyResearchResearch = table.Column(type: "integer", nullable: false), + TechnologyHealingResearch = table.Column(type: "integer", nullable: false), + TotalKills = table.Column(type: "bigint", nullable: false), + TotalDeaths = table.Column(type: "bigint", nullable: false), + ResourcesGathered = table.Column(type: "bigint", nullable: false), + ResourcesShared = table.Column(type: "bigint", nullable: false), + KvKParticipations = table.Column(type: "integer", nullable: false), + KvKWins = table.Column(type: "integer", nullable: false), + LastKvKParticipation = table.Column(type: "timestamp with time zone", nullable: true), + CurrentCoalitionId = table.Column(type: "integer", nullable: true), + IsEligibleForKvK = table.Column(type: "boolean", nullable: false), + AcceptsCoalitionInvites = table.Column(type: "boolean", nullable: false), + CoalitionReputationScore = table.Column(type: "integer", nullable: false), + TreasuryFood = table.Column(type: "bigint", nullable: false), + TreasuryWood = table.Column(type: "bigint", nullable: false), + TreasuryIron = table.Column(type: "bigint", nullable: false), + TreasurySilver = table.Column(type: "bigint", nullable: false), + TreasuryMithril = table.Column(type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Alliances", x => x.Id); + table.ForeignKey( + name: "FK_Alliances_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Players", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + AllianceId = table.Column(type: "integer", nullable: true), + CastleLevel = table.Column(type: "integer", nullable: false, defaultValue: 1), + Power = table.Column(type: "bigint", nullable: false, defaultValue: 0L), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + LastActiveAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + CoordinateX = table.Column(type: "integer", nullable: false), + CoordinateY = table.Column(type: "integer", nullable: false), + Food = table.Column(type: "bigint", nullable: false), + Wood = table.Column(type: "bigint", nullable: false), + Iron = table.Column(type: "bigint", nullable: false), + Silver = table.Column(type: "bigint", nullable: false), + Mithril = table.Column(type: "bigint", nullable: false), + FoodProtected = table.Column(type: "bigint", nullable: false), + WoodProtected = table.Column(type: "bigint", nullable: false), + IronProtected = table.Column(type: "bigint", nullable: false), + SilverProtected = table.Column(type: "bigint", nullable: false), + MithrilProtected = table.Column(type: "bigint", nullable: false), + Gold = table.Column(type: "integer", nullable: false), + InfantryT1 = table.Column(type: "bigint", nullable: false), + CavalryT1 = table.Column(type: "bigint", nullable: false), + BowmenT1 = table.Column(type: "bigint", nullable: false), + SiegeT1 = table.Column(type: "bigint", nullable: false), + InfantryT2 = table.Column(type: "bigint", nullable: false), + CavalryT2 = table.Column(type: "bigint", nullable: false), + BowmenT2 = table.Column(type: "bigint", nullable: false), + SiegeT2 = table.Column(type: "bigint", nullable: false), + InfantryT3 = table.Column(type: "bigint", nullable: false), + CavalryT3 = table.Column(type: "bigint", nullable: false), + BowmenT3 = table.Column(type: "bigint", nullable: false), + SiegeT3 = table.Column(type: "bigint", nullable: false), + InfantryT4 = table.Column(type: "bigint", nullable: false), + CavalryT4 = table.Column(type: "bigint", nullable: false), + BowmenT4 = table.Column(type: "bigint", nullable: false), + SiegeT4 = table.Column(type: "bigint", nullable: false), + InfantryT5 = table.Column(type: "bigint", nullable: false), + CavalryT5 = table.Column(type: "bigint", nullable: false), + BowmenT5 = table.Column(type: "bigint", nullable: false), + SiegeT5 = table.Column(type: "bigint", nullable: false), + InfantryT10 = table.Column(type: "bigint", nullable: false), + CavalryT10 = table.Column(type: "bigint", nullable: false), + BowmenT10 = table.Column(type: "bigint", nullable: false), + SiegeT10 = table.Column(type: "bigint", nullable: false), + InfantryT11 = table.Column(type: "bigint", nullable: false), + CavalryT11 = table.Column(type: "bigint", nullable: false), + BowmenT11 = table.Column(type: "bigint", nullable: false), + SiegeT11 = table.Column(type: "bigint", nullable: false), + InfantryT12 = table.Column(type: "bigint", nullable: false), + CavalryT12 = table.Column(type: "bigint", nullable: false), + BowmenT12 = table.Column(type: "bigint", nullable: false), + SiegeT12 = table.Column(type: "bigint", nullable: false), + InfantryT13 = table.Column(type: "bigint", nullable: false), + CavalryT13 = table.Column(type: "bigint", nullable: false), + BowmenT13 = table.Column(type: "bigint", nullable: false), + SiegeT13 = table.Column(type: "bigint", nullable: false), + AttacksWon = table.Column(type: "bigint", nullable: false), + AttacksLost = table.Column(type: "bigint", nullable: false), + DefensesWon = table.Column(type: "bigint", nullable: false), + DefensesLost = table.Column(type: "bigint", nullable: false), + TroopsKilled = table.Column(type: "bigint", nullable: false), + TroopsLost = table.Column(type: "bigint", nullable: false), + ResourcesGathered = table.Column(type: "bigint", nullable: false), + ResourcesRaided = table.Column(type: "bigint", nullable: false), + AcceptAllianceInvites = table.Column(type: "boolean", nullable: false), + ShowOnlineStatus = table.Column(type: "boolean", nullable: false), + EnablePushNotifications = table.Column(type: "boolean", nullable: false), + AutoUseSpeedBoosts = table.Column(type: "boolean", nullable: false), + Biography = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + VipLevel = table.Column(type: "integer", nullable: false), + VipExpiryDate = table.Column(type: "timestamp with time zone", nullable: true), + HasActiveDragon = table.Column(type: "boolean", nullable: false), + DragonExpiryDate = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Players", x => x.Id); + table.ForeignKey( + name: "FK_Players_Alliances_AllianceId", + column: x => x.AllianceId, + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_Players_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CombatLogs", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AttackerPlayerId = table.Column(type: "integer", nullable: false), + DefenderPlayerId = table.Column(type: "integer", nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + AttackerAllianceId = table.Column(type: "integer", nullable: true), + DefenderAllianceId = table.Column(type: "integer", nullable: true), + CombatType = table.Column(type: "integer", nullable: false), + Result = table.Column(type: "integer", nullable: false), + Timestamp = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + BattleX = table.Column(type: "integer", nullable: false), + BattleY = table.Column(type: "integer", nullable: false), + WasFieldInterception = table.Column(type: "boolean", nullable: false), + InterceptorPlayerId = table.Column(type: "integer", nullable: true), + InterceptionType = table.Column(type: "integer", nullable: true), + MarchStartTime = table.Column(type: "timestamp with time zone", nullable: false), + MarchArrivalTime = table.Column(type: "timestamp with time zone", nullable: false), + MarchDurationSeconds = table.Column(type: "integer", nullable: false), + UsedSpeedBoosts = table.Column(type: "boolean", nullable: false), + SpeedBoostLevel = table.Column(type: "integer", nullable: false), + AttackerInfantryBefore = table.Column(type: "bigint", nullable: false), + AttackerCavalryBefore = table.Column(type: "bigint", nullable: false), + AttackerBowmenBefore = table.Column(type: "bigint", nullable: false), + AttackerSiegeBefore = table.Column(type: "bigint", nullable: false), + AttackerHighestTroopTier = table.Column(type: "integer", nullable: false), + AttackerInfantryAfter = table.Column(type: "bigint", nullable: false), + AttackerCavalryAfter = table.Column(type: "bigint", nullable: false), + AttackerBowmenAfter = table.Column(type: "bigint", nullable: false), + AttackerSiegeAfter = table.Column(type: "bigint", nullable: false), + DefenderInfantryBefore = table.Column(type: "bigint", nullable: false), + DefenderCavalryBefore = table.Column(type: "bigint", nullable: false), + DefenderBowmenBefore = table.Column(type: "bigint", nullable: false), + DefenderSiegeBefore = table.Column(type: "bigint", nullable: false), + DefenderHighestTroopTier = table.Column(type: "integer", nullable: false), + DefenderInfantryAfter = table.Column(type: "bigint", nullable: false), + DefenderCavalryAfter = table.Column(type: "bigint", nullable: false), + DefenderBowmenAfter = table.Column(type: "bigint", nullable: false), + DefenderSiegeAfter = table.Column(type: "bigint", nullable: false), + AttackerPowerBefore = table.Column(type: "bigint", nullable: false), + DefenderPowerBefore = table.Column(type: "bigint", nullable: false), + AttackerCasualties = table.Column(type: "bigint", nullable: false), + DefenderCasualties = table.Column(type: "bigint", nullable: false), + AttackerWoundedTroops = table.Column(type: "bigint", nullable: false), + DefenderWoundedTroops = table.Column(type: "bigint", nullable: false), + AttackerHadDragon = table.Column(type: "boolean", nullable: false), + DefenderHadDragon = table.Column(type: "boolean", nullable: false), + AttackerDragonSkillsUsed = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + DefenderDragonSkillsUsed = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + AttackerDragonBonus = table.Column(type: "double precision", nullable: false), + DefenderDragonBonus = table.Column(type: "double precision", nullable: false), + FoodTransferred = table.Column(type: "bigint", nullable: false), + WoodTransferred = table.Column(type: "bigint", nullable: false), + IronTransferred = table.Column(type: "bigint", nullable: false), + SilverTransferred = table.Column(type: "bigint", nullable: false), + MithrilTransferred = table.Column(type: "bigint", nullable: false), + AttackerAllianceAttackBonus = table.Column(type: "double precision", nullable: false), + AttackerAllianceDefenseBonus = table.Column(type: "double precision", nullable: false), + AttackerAllianceHealthBonus = table.Column(type: "double precision", nullable: false), + DefenderAllianceAttackBonus = table.Column(type: "double precision", nullable: false), + DefenderAllianceDefenseBonus = table.Column(type: "double precision", nullable: false), + DefenderAllianceHealthBonus = table.Column(type: "double precision", nullable: false), + WasKvKBattle = table.Column(type: "boolean", nullable: false), + KvKEventId = table.Column(type: "integer", nullable: true), + CoalitionId = table.Column(type: "integer", nullable: true), + WasInForestZone = table.Column(type: "boolean", nullable: false), + ForestSpeedReduction = table.Column(type: "double precision", nullable: false), + DetailedBattleReport = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), + BattleNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + AttackerPlayerId1 = table.Column(type: "integer", nullable: false), + DefenderPlayerId1 = table.Column(type: "integer", nullable: false), + KingdomId1 = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CombatLogs", x => x.Id); + table.ForeignKey( + name: "FK_CombatLogs_Alliances_AttackerAllianceId", + column: x => x.AttackerAllianceId, + principalTable: "Alliances", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CombatLogs_Alliances_DefenderAllianceId", + column: x => x.DefenderAllianceId, + principalTable: "Alliances", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CombatLogs_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Kingdoms_KingdomId1", + column: x => x.KingdomId1, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CombatLogs_Players_AttackerPlayerId", + column: x => x.AttackerPlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Players_AttackerPlayerId1", + column: x => x.AttackerPlayerId1, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CombatLogs_Players_DefenderPlayerId", + column: x => x.DefenderPlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Players_DefenderPlayerId1", + column: x => x.DefenderPlayerId1, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CombatLogs_Players_InterceptorPlayerId", + column: x => x.InterceptorPlayerId, + principalTable: "Players", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "PurchaseLogs", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PlayerId = table.Column(type: "integer", nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + AllianceId = table.Column(type: "integer", nullable: true), + ProductId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + ProductName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + PurchaseType = table.Column(type: "integer", nullable: false), + PaymentMethod = table.Column(type: "integer", nullable: false), + Amount = table.Column(type: "numeric(18,2)", nullable: false), + Currency = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), + PurchaseDate = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + ProcessedAt = table.Column(type: "timestamp with time zone", nullable: true), + Status = table.Column(type: "integer", nullable: false), + TransactionId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + PlatformTransactionId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + PlatformReceiptData = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + Platform = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), + PlatformUserId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + DeviceInfo = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + IPAddress = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + UserAgent = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + GoldPurchased = table.Column(type: "integer", nullable: false), + GoldSpent = table.Column(type: "integer", nullable: false), + GoldBalanceBefore = table.Column(type: "integer", nullable: false), + GoldBalanceAfter = table.Column(type: "integer", nullable: false), + PlatformFee = table.Column(type: "numeric", nullable: false), + NetRevenue = table.Column(type: "numeric", nullable: false), + TaxAmount = table.Column(type: "numeric", nullable: false), + RefundAmount = table.Column(type: "numeric", nullable: false), + IsChargedBack = table.Column(type: "boolean", nullable: false), + ChargebackDate = table.Column(type: "timestamp with time zone", nullable: true), + ChargebackReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + ChargebackPenalty = table.Column(type: "numeric", nullable: true), + IsSuspicious = table.Column(type: "boolean", nullable: false), + FraudReason = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + IsRefunded = table.Column(type: "boolean", nullable: false), + RefundDate = table.Column(type: "timestamp with time zone", nullable: true), + RefundReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + IsConfirmed = table.Column(type: "boolean", nullable: false), + Notes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + IsVipPurchase = table.Column(type: "boolean", nullable: false), + VipLevelBefore = table.Column(type: "integer", nullable: false), + VipLevelAfter = table.Column(type: "integer", nullable: false), + VipDaysAdded = table.Column(type: "integer", nullable: false), + VipPointsEarned = table.Column(type: "integer", nullable: false), + VipPointsBefore = table.Column(type: "integer", nullable: false), + VipPointsAfter = table.Column(type: "integer", nullable: false), + TriggeredVipMilestone = table.Column(type: "boolean", nullable: false), + VipMilestoneReached = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + IsEligibleForMonthlyReward = table.Column(type: "boolean", nullable: false), + IsEligibleForYearlyReward = table.Column(type: "boolean", nullable: false), + SecretSpendingTierBefore = table.Column(type: "integer", nullable: false), + SecretSpendingTierAfter = table.Column(type: "integer", nullable: false), + UnlockedNewSecretTier = table.Column(type: "boolean", nullable: false), + IsDragonPurchase = table.Column(type: "boolean", nullable: false), + DragonType = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + DragonDaysAdded = table.Column(type: "integer", nullable: false), + DragonSkillsUnlocked = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + IsSpeedBoostPurchase = table.Column(type: "boolean", nullable: false), + SpeedBoostQuantity = table.Column(type: "integer", nullable: false), + SpeedBoostLevel = table.Column(type: "integer", nullable: false), + SpeedBoostHours = table.Column(type: "integer", nullable: false), + IsStealthPurchase = table.Column(type: "boolean", nullable: false), + StealthUsesAdded = table.Column(type: "integer", nullable: false), + StealthType = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + IsResourcePackage = table.Column(type: "boolean", nullable: false), + FoodReceived = table.Column(type: "bigint", nullable: false), + WoodReceived = table.Column(type: "bigint", nullable: false), + IronReceived = table.Column(type: "bigint", nullable: false), + SilverReceived = table.Column(type: "bigint", nullable: false), + MithrilReceived = table.Column(type: "bigint", nullable: false), + IsConstructionBoost = table.Column(type: "boolean", nullable: false), + IsTrainingBoost = table.Column(type: "boolean", nullable: false), + IsResearchBoost = table.Column(type: "boolean", nullable: false), + BoostHours = table.Column(type: "integer", nullable: false), + BoostPercentage = table.Column(type: "integer", nullable: false), + SkillAlternativeUsed = table.Column(type: "double precision", nullable: false), + HasSkillBasedAlternative = table.Column(type: "boolean", nullable: false), + SkillAlternativeDescription = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + TimeInvestmentHours = table.Column(type: "numeric", nullable: false), + IsBundle = table.Column(type: "boolean", nullable: false), + BundleContents = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + BundleDiscountPercentage = table.Column(type: "double precision", nullable: false), + WasRefunded = table.Column(type: "boolean", nullable: false), + RefundedAt = table.Column(type: "timestamp with time zone", nullable: true), + WasChargeback = table.Column(type: "boolean", nullable: false), + ChargebackAt = table.Column(type: "timestamp with time zone", nullable: true), + ChargebackDisputeDeadline = table.Column(type: "timestamp with time zone", nullable: true), + ChargebackDisputed = table.Column(type: "boolean", nullable: false), + DisputeStatus = table.Column(type: "integer", nullable: true), + ChargebackFee = table.Column(type: "numeric", nullable: false), + FraudScore = table.Column(type: "integer", nullable: false), + IsFraudSuspected = table.Column(type: "boolean", nullable: false), + FraudNotes = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + RequiresManualReview = table.Column(type: "boolean", nullable: false), + IsHighRiskTransaction = table.Column(type: "boolean", nullable: false), + MinutesFromRegistration = table.Column(type: "integer", nullable: false), + PurchasesInLast24Hours = table.Column(type: "integer", nullable: false), + SpendingInLast24Hours = table.Column(type: "numeric", nullable: false), + IsVelocityFlagged = table.Column(type: "boolean", nullable: false), + IsNewDevicePurchase = table.Column(type: "boolean", nullable: false), + MonthlySpendingBefore = table.Column(type: "numeric", nullable: false), + MonthlySpendingAfter = table.Column(type: "numeric", nullable: false), + LifetimeSpendingBefore = table.Column(type: "numeric", nullable: false), + LifetimeSpendingAfter = table.Column(type: "numeric", nullable: false), + MonthlyPurchaseCount = table.Column(type: "integer", nullable: false), + LifetimePurchaseCount = table.Column(type: "integer", nullable: false), + DetailedPurchaseData = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + PurchaseNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + CampaignId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + PromotionCode = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + IsFirstPurchase = table.Column(type: "boolean", nullable: false), + IsFirstMonthlyPurchase = table.Column(type: "boolean", nullable: false), + DaysSinceLastPurchase = table.Column(type: "integer", nullable: false), + PlayerId1 = table.Column(type: "integer", nullable: false), + KingdomId1 = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PurchaseLogs", x => x.Id); + table.ForeignKey( + name: "FK_PurchaseLogs_Alliances_AllianceId", + column: x => x.AllianceId, + principalTable: "Alliances", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_PurchaseLogs_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PurchaseLogs_Kingdoms_KingdomId1", + column: x => x.KingdomId1, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PurchaseLogs_Players_PlayerId", + column: x => x.PlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PurchaseLogs_Players_PlayerId1", + column: x => x.PlayerId1, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AllianceInvitation_AllianceId", + table: "AllianceInvitation", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceInvitation_InvitedById", + table: "AllianceInvitation", + column: "InvitedById"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceInvitation_PlayerId", + table: "AllianceInvitation", + column: "PlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceRole_AllianceId", + table: "AllianceRole", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceRole_AssignedById", + table: "AllianceRole", + column: "AssignedById"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceRole_PlayerId", + table: "AllianceRole", + column: "PlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Kingdom_Power", + table: "Alliances", + columns: new[] { "KingdomId", "Power" }); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_KingdomId", + table: "Alliances", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_LeaderId", + table: "Alliances", + column: "LeaderId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Name", + table: "Alliances", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Power", + table: "Alliances", + column: "Power"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Tag", + table: "Alliances", + column: "Tag"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerAllianceId", + table: "CombatLogs", + column: "AttackerAllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerPlayerId", + table: "CombatLogs", + column: "AttackerPlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerPlayerId1", + table: "CombatLogs", + column: "AttackerPlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderAllianceId", + table: "CombatLogs", + column: "DefenderAllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderPlayerId", + table: "CombatLogs", + column: "DefenderPlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderPlayerId1", + table: "CombatLogs", + column: "DefenderPlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_InterceptorPlayerId", + table: "CombatLogs", + column: "InterceptorPlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_Kingdom_Time", + table: "CombatLogs", + columns: new[] { "KingdomId", "Timestamp" }); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_KingdomId", + table: "CombatLogs", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_KingdomId1", + table: "CombatLogs", + column: "KingdomId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_Timestamp", + table: "CombatLogs", + column: "Timestamp"); + + migrationBuilder.CreateIndex( + name: "IX_Kingdoms_Name", + table: "Kingdoms", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Kingdoms_Number", + table: "Kingdoms", + column: "Number", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Player_Claims_UserId", + table: "Player_Claims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Player_Logins_UserId", + table: "Player_Logins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Player_Roles_RoleId", + table: "Player_Roles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_Players_AllianceId", + table: "Players", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_Players_Kingdom_Alliance", + table: "Players", + columns: new[] { "KingdomId", "AllianceId" }); + + migrationBuilder.CreateIndex( + name: "IX_Players_Kingdom_Power", + table: "Players", + columns: new[] { "KingdomId", "Power" }); + + migrationBuilder.CreateIndex( + name: "IX_Players_KingdomId", + table: "Players", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_Players_Name", + table: "Players", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Players_Power", + table: "Players", + column: "Power"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "Players_Auth", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "Players_Auth", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_AllianceId", + table: "PurchaseLogs", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_Kingdom_Time", + table: "PurchaseLogs", + columns: new[] { "KingdomId", "PurchaseDate" }); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_KingdomId", + table: "PurchaseLogs", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_KingdomId1", + table: "PurchaseLogs", + column: "KingdomId1"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_PlayerId", + table: "PurchaseLogs", + column: "PlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_PlayerId1", + table: "PurchaseLogs", + column: "PlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_PurchaseDate", + table: "PurchaseLogs", + column: "PurchaseDate"); + + migrationBuilder.CreateIndex( + name: "IX_Role_Claims_RoleId", + table: "Role_Claims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "Roles", + column: "NormalizedName", + unique: true); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceInvitation_Alliances_AllianceId", + table: "AllianceInvitation", + column: "AllianceId", + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceInvitation_Players_InvitedById", + table: "AllianceInvitation", + column: "InvitedById", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceInvitation_Players_PlayerId", + table: "AllianceInvitation", + column: "PlayerId", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceRole_Alliances_AllianceId", + table: "AllianceRole", + column: "AllianceId", + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceRole_Players_AssignedById", + table: "AllianceRole", + column: "AssignedById", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceRole_Players_PlayerId", + table: "AllianceRole", + column: "PlayerId", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Alliances_Players_LeaderId", + table: "Alliances", + column: "LeaderId", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Players_Alliances_AllianceId", + table: "Players"); + + migrationBuilder.DropTable( + name: "AllianceInvitation"); + + migrationBuilder.DropTable( + name: "AllianceRole"); + + migrationBuilder.DropTable( + name: "CombatLogs"); + + migrationBuilder.DropTable( + name: "Player_Claims"); + + migrationBuilder.DropTable( + name: "Player_Logins"); + + migrationBuilder.DropTable( + name: "Player_Roles"); + + migrationBuilder.DropTable( + name: "Player_Tokens"); + + migrationBuilder.DropTable( + name: "PurchaseLogs"); + + migrationBuilder.DropTable( + name: "Role_Claims"); + + migrationBuilder.DropTable( + name: "Players_Auth"); + + migrationBuilder.DropTable( + name: "Roles"); + + migrationBuilder.DropTable( + name: "Alliances"); + + migrationBuilder.DropTable( + name: "Players"); + + migrationBuilder.DropTable( + name: "Kingdoms"); + } + } +} diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/GameDbContextModelSnapshot.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/GameDbContextModelSnapshot.cs new file mode 100644 index 0000000..6ed8c41 --- /dev/null +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Migrations/GameDbContextModelSnapshot.cs @@ -0,0 +1,1798 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using ShadowedRealms.Data.Contexts; + +#nullable disable + +namespace ShadowedRealms.API.Migrations +{ + [DbContext(typeof(GameDbContext))] + partial class GameDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("Role_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Logins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("Player_Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Player_Tokens", (string)null); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptsCoalitionInvites") + .HasColumnType("boolean"); + + b.Property("CoalitionReputationScore") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentCoalitionId") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("EconomicGatheringResearch") + .HasColumnType("integer"); + + b.Property("EconomicProductionResearch") + .HasColumnType("integer"); + + b.Property("EconomicStorageResearch") + .HasColumnType("integer"); + + b.Property("EconomicTaxationResearch") + .HasColumnType("integer"); + + b.Property("EconomicTradeResearch") + .HasColumnType("integer"); + + b.Property("ExperiencePoints") + .HasColumnType("bigint"); + + b.Property("FortressLevel") + .HasColumnType("integer"); + + b.Property("FortressX") + .HasColumnType("integer"); + + b.Property("FortressY") + .HasColumnType("integer"); + + b.Property("HasTerritory") + .HasColumnType("boolean"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsOpenToJoin") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKParticipations") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastKvKParticipation") + .HasColumnType("timestamp with time zone"); + + b.Property("LeaderId") + .HasColumnType("integer"); + + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("MaxMembers") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(50); + + b.Property("MilitaryAttackResearch") + .HasColumnType("integer"); + + b.Property("MilitaryCapacityResearch") + .HasColumnType("integer"); + + b.Property("MilitaryDefenseResearch") + .HasColumnType("integer"); + + b.Property("MilitaryHealthResearch") + .HasColumnType("integer"); + + b.Property("MilitarySpeedResearch") + .HasColumnType("integer"); + + b.Property("MinCastleLevelToJoin") + .HasColumnType("integer"); + + b.Property("MinPowerToJoin") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("RequireApproval") + .HasColumnType("boolean"); + + b.Property("ResourceBuildingCount") + .HasColumnType("integer"); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesShared") + .HasColumnType("bigint"); + + b.Property("Tag") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("character varying(5)"); + + b.Property("TechnologyConstructionResearch") + .HasColumnType("integer"); + + b.Property("TechnologyHealingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyResearchResearch") + .HasColumnType("integer"); + + b.Property("TechnologyTrainingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyUpgradeResearch") + .HasColumnType("integer"); + + b.Property("TotalDeaths") + .HasColumnType("bigint"); + + b.Property("TotalKills") + .HasColumnType("bigint"); + + b.Property("TowerCount") + .HasColumnType("integer"); + + b.Property("TreasuryFood") + .HasColumnType("bigint"); + + b.Property("TreasuryIron") + .HasColumnType("bigint"); + + b.Property("TreasuryMithril") + .HasColumnType("bigint"); + + b.Property("TreasurySilver") + .HasColumnType("bigint"); + + b.Property("TreasuryWood") + .HasColumnType("bigint"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("KingdomId"); + + b.HasIndex("LeaderId") + .IsUnique(); + + b.HasIndex("Name"); + + b.HasIndex("Power"); + + b.HasIndex("Tag"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Alliances_Kingdom_Power"); + + b.ToTable("Alliances"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("InvitedById") + .HasColumnType("integer"); + + b.Property("IsAccepted") + .HasColumnType("boolean"); + + b.Property("IsRejected") + .HasColumnType("boolean"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("InvitedById"); + + b.HasIndex("PlayerId"); + + b.ToTable("AllianceInvitation"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AssignedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("AssignedById") + .HasColumnType("integer"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("Rank") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("AssignedById"); + + b.HasIndex("PlayerId"); + + b.ToTable("AllianceRole"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttackerAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceId") + .HasColumnType("integer"); + + b.Property("AttackerBowmenAfter") + .HasColumnType("bigint"); + + b.Property("AttackerBowmenBefore") + .HasColumnType("bigint"); + + b.Property("AttackerCasualties") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerDragonBonus") + .HasColumnType("double precision"); + + b.Property("AttackerDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("AttackerHadDragon") + .HasColumnType("boolean"); + + b.Property("AttackerHighestTroopTier") + .HasColumnType("integer"); + + b.Property("AttackerInfantryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerInfantryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerPlayerId") + .HasColumnType("integer"); + + b.Property("AttackerPlayerId1") + .HasColumnType("integer"); + + b.Property("AttackerPowerBefore") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeAfter") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeBefore") + .HasColumnType("bigint"); + + b.Property("AttackerWoundedTroops") + .HasColumnType("bigint"); + + b.Property("BattleNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BattleX") + .HasColumnType("integer"); + + b.Property("BattleY") + .HasColumnType("integer"); + + b.Property("CoalitionId") + .HasColumnType("integer"); + + b.Property("CombatType") + .HasColumnType("integer"); + + b.Property("DefenderAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceId") + .HasColumnType("integer"); + + b.Property("DefenderBowmenAfter") + .HasColumnType("bigint"); + + b.Property("DefenderBowmenBefore") + .HasColumnType("bigint"); + + b.Property("DefenderCasualties") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderDragonBonus") + .HasColumnType("double precision"); + + b.Property("DefenderDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("DefenderHadDragon") + .HasColumnType("boolean"); + + b.Property("DefenderHighestTroopTier") + .HasColumnType("integer"); + + b.Property("DefenderInfantryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderInfantryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderPlayerId") + .HasColumnType("integer"); + + b.Property("DefenderPlayerId1") + .HasColumnType("integer"); + + b.Property("DefenderPowerBefore") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeAfter") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeBefore") + .HasColumnType("bigint"); + + b.Property("DefenderWoundedTroops") + .HasColumnType("bigint"); + + b.Property("DetailedBattleReport") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("FoodTransferred") + .HasColumnType("bigint"); + + b.Property("ForestSpeedReduction") + .HasColumnType("double precision"); + + b.Property("InterceptionType") + .HasColumnType("integer"); + + b.Property("InterceptorPlayerId") + .HasColumnType("integer"); + + b.Property("IronTransferred") + .HasColumnType("bigint"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("KvKEventId") + .HasColumnType("integer"); + + b.Property("MarchArrivalTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MarchDurationSeconds") + .HasColumnType("integer"); + + b.Property("MarchStartTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MithrilTransferred") + .HasColumnType("bigint"); + + b.Property("Result") + .HasColumnType("integer"); + + b.Property("SilverTransferred") + .HasColumnType("bigint"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("UsedSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("WasFieldInterception") + .HasColumnType("boolean"); + + b.Property("WasInForestZone") + .HasColumnType("boolean"); + + b.Property("WasKvKBattle") + .HasColumnType("boolean"); + + b.Property("WoodTransferred") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AttackerAllianceId"); + + b.HasIndex("AttackerPlayerId"); + + b.HasIndex("AttackerPlayerId1"); + + b.HasIndex("DefenderAllianceId"); + + b.HasIndex("DefenderPlayerId"); + + b.HasIndex("DefenderPlayerId1"); + + b.HasIndex("InterceptorPlayerId"); + + b.HasIndex("KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("Timestamp"); + + b.HasIndex("KingdomId", "Timestamp") + .HasDatabaseName("IX_CombatLogs_Kingdom_Time"); + + b.ToTable("CombatLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptingNewPlayers") + .HasColumnType("boolean"); + + b.Property("AutoKickInactivePlayers") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("CurrentPowerRank") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EnableTaxSystem") + .HasColumnType("boolean"); + + b.Property("InactivityKickDays") + .HasColumnType("integer"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMerger") + .HasColumnType("boolean"); + + b.Property("IsInKvK") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKDraws") + .HasColumnType("integer"); + + b.Property("KvKHostAllianceId") + .HasColumnType("integer"); + + b.Property("KvKLosses") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastActivity") + .HasColumnType("timestamp with time zone"); + + b.Property("LastKvKDate") + .HasColumnType("timestamp with time zone"); + + b.Property("MaxPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1500); + + b.Property("MergerAvailableDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Number") + .HasColumnType("integer"); + + b.Property("TaxRate") + .HasColumnType("numeric"); + + b.Property("TotalPower") + .HasColumnType("bigint"); + + b.Property("TotalTaxCollected") + .HasColumnType("numeric"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.HasIndex("Number") + .IsUnique(); + + b.ToTable("Kingdoms"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptAllianceInvites") + .HasColumnType("boolean"); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AttacksLost") + .HasColumnType("bigint"); + + b.Property("AttacksWon") + .HasColumnType("bigint"); + + b.Property("AutoUseSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("Biography") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BowmenT1") + .HasColumnType("bigint"); + + b.Property("BowmenT10") + .HasColumnType("bigint"); + + b.Property("BowmenT11") + .HasColumnType("bigint"); + + b.Property("BowmenT12") + .HasColumnType("bigint"); + + b.Property("BowmenT13") + .HasColumnType("bigint"); + + b.Property("BowmenT2") + .HasColumnType("bigint"); + + b.Property("BowmenT3") + .HasColumnType("bigint"); + + b.Property("BowmenT4") + .HasColumnType("bigint"); + + b.Property("BowmenT5") + .HasColumnType("bigint"); + + b.Property("CastleLevel") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("CavalryT1") + .HasColumnType("bigint"); + + b.Property("CavalryT10") + .HasColumnType("bigint"); + + b.Property("CavalryT11") + .HasColumnType("bigint"); + + b.Property("CavalryT12") + .HasColumnType("bigint"); + + b.Property("CavalryT13") + .HasColumnType("bigint"); + + b.Property("CavalryT2") + .HasColumnType("bigint"); + + b.Property("CavalryT3") + .HasColumnType("bigint"); + + b.Property("CavalryT4") + .HasColumnType("bigint"); + + b.Property("CavalryT5") + .HasColumnType("bigint"); + + b.Property("CoordinateX") + .HasColumnType("integer"); + + b.Property("CoordinateY") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("DefensesLost") + .HasColumnType("bigint"); + + b.Property("DefensesWon") + .HasColumnType("bigint"); + + b.Property("DragonExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("EnablePushNotifications") + .HasColumnType("boolean"); + + b.Property("Food") + .HasColumnType("bigint"); + + b.Property("FoodProtected") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("integer"); + + b.Property("HasActiveDragon") + .HasColumnType("boolean"); + + b.Property("InfantryT1") + .HasColumnType("bigint"); + + b.Property("InfantryT10") + .HasColumnType("bigint"); + + b.Property("InfantryT11") + .HasColumnType("bigint"); + + b.Property("InfantryT12") + .HasColumnType("bigint"); + + b.Property("InfantryT13") + .HasColumnType("bigint"); + + b.Property("InfantryT2") + .HasColumnType("bigint"); + + b.Property("InfantryT3") + .HasColumnType("bigint"); + + b.Property("InfantryT4") + .HasColumnType("bigint"); + + b.Property("InfantryT5") + .HasColumnType("bigint"); + + b.Property("Iron") + .HasColumnType("bigint"); + + b.Property("IronProtected") + .HasColumnType("bigint"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("LastActiveAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("Mithril") + .HasColumnType("bigint"); + + b.Property("MithrilProtected") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesRaided") + .HasColumnType("bigint"); + + b.Property("ShowOnlineStatus") + .HasColumnType("boolean"); + + b.Property("SiegeT1") + .HasColumnType("bigint"); + + b.Property("SiegeT10") + .HasColumnType("bigint"); + + b.Property("SiegeT11") + .HasColumnType("bigint"); + + b.Property("SiegeT12") + .HasColumnType("bigint"); + + b.Property("SiegeT13") + .HasColumnType("bigint"); + + b.Property("SiegeT2") + .HasColumnType("bigint"); + + b.Property("SiegeT3") + .HasColumnType("bigint"); + + b.Property("SiegeT4") + .HasColumnType("bigint"); + + b.Property("SiegeT5") + .HasColumnType("bigint"); + + b.Property("Silver") + .HasColumnType("bigint"); + + b.Property("SilverProtected") + .HasColumnType("bigint"); + + b.Property("TroopsKilled") + .HasColumnType("bigint"); + + b.Property("TroopsLost") + .HasColumnType("bigint"); + + b.Property("VipExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("VipLevel") + .HasColumnType("integer"); + + b.Property("Wood") + .HasColumnType("bigint"); + + b.Property("WoodProtected") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("KingdomId"); + + b.HasIndex("Name"); + + b.HasIndex("Power"); + + b.HasIndex("KingdomId", "AllianceId") + .HasDatabaseName("IX_Players_Kingdom_Alliance"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Players_Kingdom_Power"); + + b.ToTable("Players"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("BoostHours") + .HasColumnType("integer"); + + b.Property("BoostPercentage") + .HasColumnType("integer"); + + b.Property("BundleContents") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BundleDiscountPercentage") + .HasColumnType("double precision"); + + b.Property("CampaignId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ChargebackAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputeDeadline") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputed") + .HasColumnType("boolean"); + + b.Property("ChargebackFee") + .HasColumnType("numeric"); + + b.Property("ChargebackPenalty") + .HasColumnType("numeric"); + + b.Property("ChargebackReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("DaysSinceLastPurchase") + .HasColumnType("integer"); + + b.Property("DetailedPurchaseData") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("DeviceInfo") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DisputeStatus") + .HasColumnType("integer"); + + b.Property("DragonDaysAdded") + .HasColumnType("integer"); + + b.Property("DragonSkillsUnlocked") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("DragonType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("FoodReceived") + .HasColumnType("bigint"); + + b.Property("FraudNotes") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("FraudReason") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("FraudScore") + .HasColumnType("integer"); + + b.Property("GoldBalanceAfter") + .HasColumnType("integer"); + + b.Property("GoldBalanceBefore") + .HasColumnType("integer"); + + b.Property("GoldPurchased") + .HasColumnType("integer"); + + b.Property("GoldSpent") + .HasColumnType("integer"); + + b.Property("HasSkillBasedAlternative") + .HasColumnType("boolean"); + + b.Property("IPAddress") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("IronReceived") + .HasColumnType("bigint"); + + b.Property("IsBundle") + .HasColumnType("boolean"); + + b.Property("IsChargedBack") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsConstructionBoost") + .HasColumnType("boolean"); + + b.Property("IsDragonPurchase") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMonthlyReward") + .HasColumnType("boolean"); + + b.Property("IsEligibleForYearlyReward") + .HasColumnType("boolean"); + + b.Property("IsFirstMonthlyPurchase") + .HasColumnType("boolean"); + + b.Property("IsFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsFraudSuspected") + .HasColumnType("boolean"); + + b.Property("IsHighRiskTransaction") + .HasColumnType("boolean"); + + b.Property("IsNewDevicePurchase") + .HasColumnType("boolean"); + + b.Property("IsRefunded") + .HasColumnType("boolean"); + + b.Property("IsResearchBoost") + .HasColumnType("boolean"); + + b.Property("IsResourcePackage") + .HasColumnType("boolean"); + + b.Property("IsSpeedBoostPurchase") + .HasColumnType("boolean"); + + b.Property("IsStealthPurchase") + .HasColumnType("boolean"); + + b.Property("IsSuspicious") + .HasColumnType("boolean"); + + b.Property("IsTrainingBoost") + .HasColumnType("boolean"); + + b.Property("IsVelocityFlagged") + .HasColumnType("boolean"); + + b.Property("IsVipPurchase") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("LifetimePurchaseCount") + .HasColumnType("integer"); + + b.Property("LifetimeSpendingAfter") + .HasColumnType("numeric"); + + b.Property("LifetimeSpendingBefore") + .HasColumnType("numeric"); + + b.Property("MinutesFromRegistration") + .HasColumnType("integer"); + + b.Property("MithrilReceived") + .HasColumnType("bigint"); + + b.Property("MonthlyPurchaseCount") + .HasColumnType("integer"); + + b.Property("MonthlySpendingAfter") + .HasColumnType("numeric"); + + b.Property("MonthlySpendingBefore") + .HasColumnType("numeric"); + + b.Property("NetRevenue") + .HasColumnType("numeric"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("Platform") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("PlatformFee") + .HasColumnType("numeric"); + + b.Property("PlatformReceiptData") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("PlatformTransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PlatformUserId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("PlayerId1") + .HasColumnType("integer"); + + b.Property("ProcessedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ProductName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PromotionCode") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PurchaseDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("PurchaseNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PurchaseType") + .HasColumnType("integer"); + + b.Property("PurchasesInLast24Hours") + .HasColumnType("integer"); + + b.Property("RefundAmount") + .HasColumnType("numeric"); + + b.Property("RefundDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RefundReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("RefundedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RequiresManualReview") + .HasColumnType("boolean"); + + b.Property("SecretSpendingTierAfter") + .HasColumnType("integer"); + + b.Property("SecretSpendingTierBefore") + .HasColumnType("integer"); + + b.Property("SilverReceived") + .HasColumnType("bigint"); + + b.Property("SkillAlternativeDescription") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SkillAlternativeUsed") + .HasColumnType("double precision"); + + b.Property("SpeedBoostHours") + .HasColumnType("integer"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("SpeedBoostQuantity") + .HasColumnType("integer"); + + b.Property("SpendingInLast24Hours") + .HasColumnType("numeric"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StealthType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("StealthUsesAdded") + .HasColumnType("integer"); + + b.Property("TaxAmount") + .HasColumnType("numeric"); + + b.Property("TimeInvestmentHours") + .HasColumnType("numeric"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("TriggeredVipMilestone") + .HasColumnType("boolean"); + + b.Property("UnlockedNewSecretTier") + .HasColumnType("boolean"); + + b.Property("UserAgent") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("VipDaysAdded") + .HasColumnType("integer"); + + b.Property("VipLevelAfter") + .HasColumnType("integer"); + + b.Property("VipLevelBefore") + .HasColumnType("integer"); + + b.Property("VipMilestoneReached") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("VipPointsAfter") + .HasColumnType("integer"); + + b.Property("VipPointsBefore") + .HasColumnType("integer"); + + b.Property("VipPointsEarned") + .HasColumnType("integer"); + + b.Property("WasChargeback") + .HasColumnType("boolean"); + + b.Property("WasRefunded") + .HasColumnType("boolean"); + + b.Property("WoodReceived") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId"); + + b.HasIndex("KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("PlayerId"); + + b.HasIndex("PlayerId1"); + + b.HasIndex("PurchaseDate"); + + b.HasIndex("KingdomId", "PurchaseDate") + .HasDatabaseName("IX_PurchaseLogs_Kingdom_Time"); + + b.ToTable("PurchaseLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Data.Contexts.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LastLoginAt") + .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("PlayerId") + .HasColumnType("integer"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Players_Auth", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Alliances") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Leader") + .WithOne() + .HasForeignKey("ShadowedRealms.Core.Models.Alliance.Alliance", "LeaderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Kingdom"); + + b.Navigation("Leader"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("PendingInvitations") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InvitedBy") + .WithMany() + .HasForeignKey("InvitedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("InvitedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Roles") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AssignedBy") + .WithMany() + .HasForeignKey("AssignedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("AssignedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "AttackerAlliance") + .WithMany() + .HasForeignKey("AttackerAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("AttackerPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AttackerPlayer") + .WithMany() + .HasForeignKey("AttackerPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "DefenderAlliance") + .WithMany() + .HasForeignKey("DefenderAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("DefenderPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "DefenderPlayer") + .WithMany() + .HasForeignKey("DefenderPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InterceptorPlayer") + .WithMany() + .HasForeignKey("InterceptorPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AttackerAlliance"); + + b.Navigation("AttackerPlayer"); + + b.Navigation("DefenderAlliance"); + + b.Navigation("DefenderPlayer"); + + b.Navigation("InterceptorPlayer"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Members") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Players") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany() + .HasForeignKey("AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Navigation("Members"); + + b.Navigation("PendingInvitations"); + + b.Navigation("Roles"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Navigation("Alliances"); + + b.Navigation("Players"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Program.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Program.cs index 0e6451f..928cff8 100644 --- a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Program.cs +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/Program.cs @@ -1,5 +1,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; +using ShadowedRealms.Data.Contexts; using System.Text; var builder = WebApplication.CreateBuilder(args); @@ -21,9 +23,10 @@ if (string.IsNullOrEmpty(connectionString)) throw new InvalidOperationException("Database connection string not configured. Set ConnectionStrings:DefaultConnection in appsettings.json or DATABASE_CONNECTION_STRING environment variable."); } -// TODO: Add Entity Framework when ready -// builder.Services.AddDbContext(options => -// options.UseNpgsql(connectionString)); +// Add Entity Framework DbContext with migrations assembly - ONLY CHANGE: Fixed migrations assembly +builder.Services.AddDbContext(options => + options.UseNpgsql(connectionString, b => + b.MigrationsAssembly("ShadowedRealms.Data"))); // CHANGED: was "ShadowedRealms.API" // =============================== // AUTHENTICATION (JWT) diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/ShadowedRealms.API.csproj b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/ShadowedRealms.API.csproj index b765c6e..95bf9ad 100644 --- a/ShadowedRealmsMobile/src/server/ShadowedRealms.API/ShadowedRealms.API.csproj +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.API/ShadowedRealms.API.csproj @@ -10,10 +10,15 @@ + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + all runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Contexts/GameDbContext.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Contexts/GameDbContext.cs index f2a8b50..ef39ffa 100644 --- a/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Contexts/GameDbContext.cs +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Contexts/GameDbContext.cs @@ -1,9 +1,9 @@ /* * File: ShadowedRealms.Data/Contexts/GameDbContext.cs * Created: 2025-10-19 - * Last Modified: 2025-10-22 - * Description: Main Entity Framework database context for Shadowed Realms. Handles all game entities with kingdom-based data partitioning and server-authoritative design. - * Last Edit Notes: Fixed PurchaseLog property references to match actual model properties + * Last Modified: 2025-10-29 + * Description: Main Entity Framework database context for Shadowed Realms. Fixed to explicitly map navigation properties to foreign keys. + * Last Edit Notes: FINAL FIX - Explicitly mapped navigation properties to foreign keys to resolve shadow property warnings */ using Microsoft.AspNetCore.Identity; @@ -65,6 +65,9 @@ namespace ShadowedRealms.Data.Contexts ConfigureCombatLogEntity(modelBuilder); ConfigurePurchaseLogEntity(modelBuilder); + // Configure related entities (fixes Alliance global query filter warnings) + ConfigureAllianceRelatedEntities(modelBuilder); + // Apply kingdom-scoped global query filters ApplyKingdomScopedFilters(modelBuilder); @@ -105,22 +108,27 @@ namespace ShadowedRealms.Data.Contexts entity.Property(p => p.LastActiveAt).IsRequired().HasDefaultValueSql("CURRENT_TIMESTAMP"); entity.Property(p => p.IsActive).IsRequired().HasDefaultValue(true); - // Relationships + // String properties with max lengths + entity.Property(p => p.Biography).HasMaxLength(500); + + // Relationships - Use navigation properties from your actual Player model entity.HasOne(p => p.Kingdom) .WithMany(k => k.Players) .HasForeignKey(p => p.KingdomId) + .HasConstraintName("FK_Players_Kingdoms_KingdomId") .OnDelete(DeleteBehavior.Restrict); entity.HasOne(p => p.Alliance) .WithMany(a => a.Members) .HasForeignKey(p => p.AllianceId) + .HasConstraintName("FK_Players_Alliances_AllianceId") .OnDelete(DeleteBehavior.SetNull); // Indexes - entity.HasIndex(p => p.KingdomId); - entity.HasIndex(p => p.AllianceId); - entity.HasIndex(p => p.Name); - entity.HasIndex(p => p.Power); + entity.HasIndex(p => p.KingdomId).HasDatabaseName("IX_Players_KingdomId"); + entity.HasIndex(p => p.AllianceId).HasDatabaseName("IX_Players_AllianceId"); + entity.HasIndex(p => p.Name).HasDatabaseName("IX_Players_Name"); + entity.HasIndex(p => p.Power).HasDatabaseName("IX_Players_Power"); }); } @@ -138,22 +146,28 @@ namespace ShadowedRealms.Data.Contexts entity.Property(a => a.IsActive).IsRequired().HasDefaultValue(true); entity.Property(a => a.MaxMembers).IsRequired().HasDefaultValue(50); - // Relationships + // String properties with max lengths + entity.Property(a => a.Description).HasMaxLength(1000); + entity.Property(a => a.WelcomeMessage).HasMaxLength(200); + + // Relationships - Use navigation properties from your actual Alliance model entity.HasOne(a => a.Kingdom) .WithMany(k => k.Alliances) .HasForeignKey(a => a.KingdomId) + .HasConstraintName("FK_Alliances_Kingdoms_KingdomId") .OnDelete(DeleteBehavior.Restrict); entity.HasOne(a => a.Leader) .WithOne() .HasForeignKey(a => a.LeaderId) + .HasConstraintName("FK_Alliances_Players_LeaderId") .OnDelete(DeleteBehavior.Restrict); // Indexes - entity.HasIndex(a => a.KingdomId); - entity.HasIndex(a => a.Name); - entity.HasIndex(a => a.Tag); - entity.HasIndex(a => a.Power); + entity.HasIndex(a => a.KingdomId).HasDatabaseName("IX_Alliances_KingdomId"); + entity.HasIndex(a => a.Name).HasDatabaseName("IX_Alliances_Name"); + entity.HasIndex(a => a.Tag).HasDatabaseName("IX_Alliances_Tag"); + entity.HasIndex(a => a.Power).HasDatabaseName("IX_Alliances_Power"); }); } @@ -169,9 +183,17 @@ namespace ShadowedRealms.Data.Contexts entity.Property(k => k.MaxPopulation).IsRequired().HasDefaultValue(1500); entity.Property(k => k.CurrentPopulation).IsRequired().HasDefaultValue(0); + // String properties with max lengths + entity.Property(k => k.Description).HasMaxLength(500); + entity.Property(k => k.WelcomeMessage).HasMaxLength(200); + + // Numeric properties with proper types + entity.Property(k => k.TaxRate).HasColumnType("decimal(5,4)"); + entity.Property(k => k.TotalTaxCollected).HasColumnType("decimal(18,2)"); + // Indexes - entity.HasIndex(k => k.Number).IsUnique(); - entity.HasIndex(k => k.Name); + entity.HasIndex(k => k.Number).IsUnique().HasDatabaseName("IX_Kingdoms_Number"); + entity.HasIndex(k => k.Name).HasDatabaseName("IX_Kingdoms_Name"); }); } @@ -187,27 +209,67 @@ namespace ShadowedRealms.Data.Contexts entity.Property(c => c.Result).IsRequired(); entity.Property(c => c.Timestamp).IsRequired().HasDefaultValueSql("CURRENT_TIMESTAMP"); - // Relationships + // String properties with max lengths + entity.Property(c => c.AttackerDragonSkillsUsed).HasMaxLength(100); + entity.Property(c => c.DefenderDragonSkillsUsed).HasMaxLength(100); + entity.Property(c => c.DetailedBattleReport).HasMaxLength(4000); + entity.Property(c => c.BattleNotes).HasMaxLength(1000); + + // CRITICAL FIX: Map navigation properties to specific foreign keys + // This prevents EF from creating shadow properties + + // NO navigation properties configured here to avoid conflicts + // Use foreign key relationships only since your CombatLog model + // doesn't have navigation properties defined + + // Simple foreign key relationships without navigation entity.HasOne() .WithMany() .HasForeignKey(c => c.AttackerPlayerId) + .HasConstraintName("FK_CombatLogs_Players_AttackerPlayerId") .OnDelete(DeleteBehavior.Restrict); entity.HasOne() .WithMany() .HasForeignKey(c => c.DefenderPlayerId) + .HasConstraintName("FK_CombatLogs_Players_DefenderPlayerId") .OnDelete(DeleteBehavior.Restrict); + entity.HasOne() + .WithMany() + .HasForeignKey(c => c.InterceptorPlayerId) + .HasConstraintName("FK_CombatLogs_Players_InterceptorPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(false); + entity.HasOne() .WithMany() .HasForeignKey(c => c.KingdomId) + .HasConstraintName("FK_CombatLogs_Kingdoms_KingdomId") .OnDelete(DeleteBehavior.Restrict); - // Indexes - entity.HasIndex(c => c.KingdomId); - entity.HasIndex(c => c.AttackerPlayerId); - entity.HasIndex(c => c.DefenderPlayerId); - entity.HasIndex(c => c.Timestamp); + entity.HasOne() + .WithMany() + .HasForeignKey(c => c.AttackerAllianceId) + .HasConstraintName("FK_CombatLogs_Alliances_AttackerAllianceId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(false); + + entity.HasOne() + .WithMany() + .HasForeignKey(c => c.DefenderAllianceId) + .HasConstraintName("FK_CombatLogs_Alliances_DefenderAllianceId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(false); + + // Indexes with explicit names + entity.HasIndex(c => c.KingdomId).HasDatabaseName("IX_CombatLogs_KingdomId"); + entity.HasIndex(c => c.AttackerPlayerId).HasDatabaseName("IX_CombatLogs_AttackerPlayerId"); + entity.HasIndex(c => c.DefenderPlayerId).HasDatabaseName("IX_CombatLogs_DefenderPlayerId"); + entity.HasIndex(c => c.InterceptorPlayerId).HasDatabaseName("IX_CombatLogs_InterceptorPlayerId"); + entity.HasIndex(c => c.AttackerAllianceId).HasDatabaseName("IX_CombatLogs_AttackerAllianceId"); + entity.HasIndex(c => c.DefenderAllianceId).HasDatabaseName("IX_CombatLogs_DefenderAllianceId"); + entity.HasIndex(c => c.Timestamp).HasDatabaseName("IX_CombatLogs_Timestamp"); }); } @@ -219,27 +281,159 @@ namespace ShadowedRealms.Data.Contexts entity.Property(p => p.PlayerId).IsRequired(); entity.Property(p => p.KingdomId).IsRequired(); entity.Property(p => p.ProductId).IsRequired().HasMaxLength(100); + entity.Property(p => p.ProductName).IsRequired().HasMaxLength(200); entity.Property(p => p.Amount).IsRequired().HasColumnType("decimal(18,2)"); entity.Property(p => p.Currency).IsRequired().HasMaxLength(10); - // FIXED: Use PurchaseDate instead of Timestamp entity.Property(p => p.PurchaseDate).IsRequired().HasDefaultValueSql("CURRENT_TIMESTAMP"); + entity.Property(p => p.TransactionId).IsRequired().HasMaxLength(200); + entity.Property(p => p.PlatformTransactionId).IsRequired().HasMaxLength(200); - // Relationships + // String properties with max lengths + entity.Property(p => p.PlatformReceiptData).HasMaxLength(500); + entity.Property(p => p.Platform).IsRequired().HasMaxLength(20); + entity.Property(p => p.PlatformUserId).HasMaxLength(100); + entity.Property(p => p.DeviceInfo).HasMaxLength(50); + entity.Property(p => p.IPAddress).HasMaxLength(100); + entity.Property(p => p.UserAgent).HasMaxLength(200); + entity.Property(p => p.ChargebackReason).HasMaxLength(500); + entity.Property(p => p.FraudReason).HasMaxLength(1000); + entity.Property(p => p.RefundReason).HasMaxLength(500); + entity.Property(p => p.Notes).HasMaxLength(1000); + entity.Property(p => p.VipMilestoneReached).HasMaxLength(100); + entity.Property(p => p.DragonType).HasMaxLength(50); + entity.Property(p => p.DragonSkillsUnlocked).HasMaxLength(200); + entity.Property(p => p.StealthType).HasMaxLength(50); + entity.Property(p => p.SkillAlternativeDescription).HasMaxLength(200); + entity.Property(p => p.BundleContents).HasMaxLength(1000); + entity.Property(p => p.DetailedPurchaseData).HasMaxLength(2000); + entity.Property(p => p.PurchaseNotes).HasMaxLength(1000); + entity.Property(p => p.CampaignId).HasMaxLength(100); + entity.Property(p => p.PromotionCode).HasMaxLength(100); + entity.Property(p => p.FraudNotes).HasMaxLength(500); + + // Decimal properties + entity.Property(p => p.PlatformFee).HasColumnType("decimal(18,2)"); + entity.Property(p => p.NetRevenue).HasColumnType("decimal(18,2)"); + entity.Property(p => p.TaxAmount).HasColumnType("decimal(18,2)"); + entity.Property(p => p.RefundAmount).HasColumnType("decimal(18,2)"); + entity.Property(p => p.ChargebackPenalty).HasColumnType("decimal(18,2)"); + entity.Property(p => p.ChargebackFee).HasColumnType("decimal(18,2)"); + entity.Property(p => p.MonthlySpendingBefore).HasColumnType("decimal(18,2)"); + entity.Property(p => p.MonthlySpendingAfter).HasColumnType("decimal(18,2)"); + entity.Property(p => p.LifetimeSpendingBefore).HasColumnType("decimal(18,2)"); + entity.Property(p => p.LifetimeSpendingAfter).HasColumnType("decimal(18,2)"); + entity.Property(p => p.SpendingInLast24Hours).HasColumnType("decimal(18,2)"); + entity.Property(p => p.TimeInvestmentHours).HasColumnType("decimal(8,2)"); + + // Simple foreign key relationships without navigation entity.HasOne() .WithMany() .HasForeignKey(p => p.PlayerId) + .HasConstraintName("FK_PurchaseLogs_Players_PlayerId") .OnDelete(DeleteBehavior.Restrict); entity.HasOne() .WithMany() .HasForeignKey(p => p.KingdomId) + .HasConstraintName("FK_PurchaseLogs_Kingdoms_KingdomId") .OnDelete(DeleteBehavior.Restrict); + entity.HasOne() + .WithMany() + .HasForeignKey(p => p.AllianceId) + .HasConstraintName("FK_PurchaseLogs_Alliances_AllianceId") + .OnDelete(DeleteBehavior.SetNull) + .IsRequired(false); + + // Indexes with explicit names + entity.HasIndex(p => p.PlayerId).HasDatabaseName("IX_PurchaseLogs_PlayerId"); + entity.HasIndex(p => p.KingdomId).HasDatabaseName("IX_PurchaseLogs_KingdomId"); + entity.HasIndex(p => p.AllianceId).HasDatabaseName("IX_PurchaseLogs_AllianceId"); + entity.HasIndex(p => p.PurchaseDate).HasDatabaseName("IX_PurchaseLogs_PurchaseDate"); + entity.HasIndex(p => p.TransactionId).HasDatabaseName("IX_PurchaseLogs_TransactionId"); + }); + } + + private void ConfigureAllianceRelatedEntities(ModelBuilder modelBuilder) + { + // Configure AllianceInvitation entity - EXPLICIT NAVIGATION MAPPING + modelBuilder.Entity(entity => + { + entity.HasKey(ai => ai.Id); + entity.Property(ai => ai.AllianceId).IsRequired(); + entity.Property(ai => ai.PlayerId).IsRequired(); + entity.Property(ai => ai.InvitedById).IsRequired(); + entity.Property(ai => ai.CreatedAt).IsRequired(); + entity.Property(ai => ai.ExpiresAt).IsRequired(); + + // CRITICAL: Map navigation properties to specific foreign keys + // This is what fixes the shadow property warnings + + // Alliance navigation + entity.HasOne(ai => ai.Alliance) + .WithMany(a => a.PendingInvitations) + .HasForeignKey(ai => ai.AllianceId) + .HasConstraintName("FK_AllianceInvitation_Alliances_AllianceId") + .OnDelete(DeleteBehavior.Cascade); + + // Player being invited navigation + entity.HasOne(ai => ai.Player) + .WithMany() + .HasForeignKey(ai => ai.PlayerId) + .HasConstraintName("FK_AllianceInvitation_Players_PlayerId") + .OnDelete(DeleteBehavior.Cascade); + + // Player who sent invite navigation + entity.HasOne(ai => ai.InvitedBy) + .WithMany() + .HasForeignKey(ai => ai.InvitedById) + .HasConstraintName("FK_AllianceInvitation_Players_InvitedById") + .OnDelete(DeleteBehavior.Cascade); + // Indexes - entity.HasIndex(p => p.KingdomId); - entity.HasIndex(p => p.PlayerId); - // FIXED: Use PurchaseDate instead of Timestamp - entity.HasIndex(p => p.PurchaseDate); + entity.HasIndex(ai => ai.AllianceId).HasDatabaseName("IX_AllianceInvitation_AllianceId"); + entity.HasIndex(ai => ai.PlayerId).HasDatabaseName("IX_AllianceInvitation_PlayerId"); + entity.HasIndex(ai => ai.InvitedById).HasDatabaseName("IX_AllianceInvitation_InvitedById"); + }); + + // Configure AllianceRole entity - EXPLICIT NAVIGATION MAPPING + modelBuilder.Entity(entity => + { + entity.HasKey(ar => ar.Id); + entity.Property(ar => ar.AllianceId).IsRequired(); + entity.Property(ar => ar.PlayerId).IsRequired(); + entity.Property(ar => ar.Rank).IsRequired(); + entity.Property(ar => ar.AssignedAt).IsRequired(); + entity.Property(ar => ar.AssignedById).IsRequired(); + + // CRITICAL: Map navigation properties to specific foreign keys + // This is what fixes the shadow property warnings + + // Alliance navigation + entity.HasOne(ar => ar.Alliance) + .WithMany(a => a.Roles) + .HasForeignKey(ar => ar.AllianceId) + .HasConstraintName("FK_AllianceRole_Alliances_AllianceId") + .OnDelete(DeleteBehavior.Cascade); + + // Player with role navigation + entity.HasOne(ar => ar.Player) + .WithMany() + .HasForeignKey(ar => ar.PlayerId) + .HasConstraintName("FK_AllianceRole_Players_PlayerId") + .OnDelete(DeleteBehavior.Cascade); + + // Player who assigned role navigation + entity.HasOne(ar => ar.AssignedBy) + .WithMany() + .HasForeignKey(ar => ar.AssignedById) + .HasConstraintName("FK_AllianceRole_Players_AssignedById") + .OnDelete(DeleteBehavior.Cascade); + + // Indexes + entity.HasIndex(ar => ar.AllianceId).HasDatabaseName("IX_AllianceRole_AllianceId"); + entity.HasIndex(ar => ar.PlayerId).HasDatabaseName("IX_AllianceRole_PlayerId"); + entity.HasIndex(ar => ar.AssignedById).HasDatabaseName("IX_AllianceRole_AssignedById"); }); } @@ -261,6 +455,10 @@ namespace ShadowedRealms.Data.Contexts // Purchase logs filter modelBuilder.Entity() .HasQueryFilter(p => _currentKingdomId == null || p.KingdomId == _currentKingdomId); + + // Apply matching filters for related entities to resolve Alliance warning + // Since AllianceInvitation and AllianceRole relate to Alliance, they inherit kingdom scoping + // through their alliance relationship - no additional filters needed } private void ConfigureIndexes(ModelBuilder modelBuilder) @@ -283,7 +481,6 @@ namespace ShadowedRealms.Data.Contexts .HasDatabaseName("IX_CombatLogs_Kingdom_Time"); modelBuilder.Entity() - // FIXED: Use PurchaseDate instead of Timestamp .HasIndex(p => new { p.KingdomId, p.PurchaseDate }) .HasDatabaseName("IX_PurchaseLogs_Kingdom_Time"); } diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.Designer.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.Designer.cs new file mode 100644 index 0000000..80815af --- /dev/null +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.Designer.cs @@ -0,0 +1,1890 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using ShadowedRealms.Data.Contexts; + +#nullable disable + +namespace ShadowedRealms.Data.Migrations +{ + [DbContext(typeof(GameDbContext))] + [Migration("20251029203255_FixEFCoreWarnings")] + partial class FixEFCoreWarnings + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("Role_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Logins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("Player_Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Player_Tokens", (string)null); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptsCoalitionInvites") + .HasColumnType("boolean"); + + b.Property("CoalitionReputationScore") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentCoalitionId") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("EconomicGatheringResearch") + .HasColumnType("integer"); + + b.Property("EconomicProductionResearch") + .HasColumnType("integer"); + + b.Property("EconomicStorageResearch") + .HasColumnType("integer"); + + b.Property("EconomicTaxationResearch") + .HasColumnType("integer"); + + b.Property("EconomicTradeResearch") + .HasColumnType("integer"); + + b.Property("ExperiencePoints") + .HasColumnType("bigint"); + + b.Property("FortressLevel") + .HasColumnType("integer"); + + b.Property("FortressX") + .HasColumnType("integer"); + + b.Property("FortressY") + .HasColumnType("integer"); + + b.Property("HasTerritory") + .HasColumnType("boolean"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsOpenToJoin") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKParticipations") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastKvKParticipation") + .HasColumnType("timestamp with time zone"); + + b.Property("LeaderId") + .HasColumnType("integer"); + + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("MaxMembers") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(50); + + b.Property("MilitaryAttackResearch") + .HasColumnType("integer"); + + b.Property("MilitaryCapacityResearch") + .HasColumnType("integer"); + + b.Property("MilitaryDefenseResearch") + .HasColumnType("integer"); + + b.Property("MilitaryHealthResearch") + .HasColumnType("integer"); + + b.Property("MilitarySpeedResearch") + .HasColumnType("integer"); + + b.Property("MinCastleLevelToJoin") + .HasColumnType("integer"); + + b.Property("MinPowerToJoin") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("RequireApproval") + .HasColumnType("boolean"); + + b.Property("ResourceBuildingCount") + .HasColumnType("integer"); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesShared") + .HasColumnType("bigint"); + + b.Property("Tag") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("character varying(5)"); + + b.Property("TechnologyConstructionResearch") + .HasColumnType("integer"); + + b.Property("TechnologyHealingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyResearchResearch") + .HasColumnType("integer"); + + b.Property("TechnologyTrainingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyUpgradeResearch") + .HasColumnType("integer"); + + b.Property("TotalDeaths") + .HasColumnType("bigint"); + + b.Property("TotalKills") + .HasColumnType("bigint"); + + b.Property("TowerCount") + .HasColumnType("integer"); + + b.Property("TreasuryFood") + .HasColumnType("bigint"); + + b.Property("TreasuryIron") + .HasColumnType("bigint"); + + b.Property("TreasuryMithril") + .HasColumnType("bigint"); + + b.Property("TreasurySilver") + .HasColumnType("bigint"); + + b.Property("TreasuryWood") + .HasColumnType("bigint"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_Alliances_KingdomId"); + + b.HasIndex("LeaderId") + .IsUnique(); + + b.HasIndex("Name") + .HasDatabaseName("IX_Alliances_Name"); + + b.HasIndex("Power") + .HasDatabaseName("IX_Alliances_Power"); + + b.HasIndex("Tag") + .HasDatabaseName("IX_Alliances_Tag"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Alliances_Kingdom_Power"); + + b.ToTable("Alliances"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("InvitedById") + .HasColumnType("integer"); + + b.Property("IsAccepted") + .HasColumnType("boolean"); + + b.Property("IsRejected") + .HasColumnType("boolean"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_AllianceInvitation_AllianceId"); + + b.HasIndex("InvitedById") + .HasDatabaseName("IX_AllianceInvitation_InvitedById"); + + b.HasIndex("PlayerId") + .HasDatabaseName("IX_AllianceInvitation_PlayerId"); + + b.ToTable("AllianceInvitation"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AssignedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("AssignedById") + .HasColumnType("integer"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("Rank") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_AllianceRole_AllianceId"); + + b.HasIndex("AssignedById") + .HasDatabaseName("IX_AllianceRole_AssignedById"); + + b.HasIndex("PlayerId") + .HasDatabaseName("IX_AllianceRole_PlayerId"); + + b.ToTable("AllianceRole"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttackerAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceId") + .HasColumnType("integer"); + + b.Property("AttackerAllianceId1") + .HasColumnType("integer"); + + b.Property("AttackerBowmenAfter") + .HasColumnType("bigint"); + + b.Property("AttackerBowmenBefore") + .HasColumnType("bigint"); + + b.Property("AttackerCasualties") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerDragonBonus") + .HasColumnType("double precision"); + + b.Property("AttackerDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("AttackerHadDragon") + .HasColumnType("boolean"); + + b.Property("AttackerHighestTroopTier") + .HasColumnType("integer"); + + b.Property("AttackerInfantryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerInfantryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerPlayerId") + .HasColumnType("integer"); + + b.Property("AttackerPlayerId1") + .HasColumnType("integer"); + + b.Property("AttackerPowerBefore") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeAfter") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeBefore") + .HasColumnType("bigint"); + + b.Property("AttackerWoundedTroops") + .HasColumnType("bigint"); + + b.Property("BattleNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BattleX") + .HasColumnType("integer"); + + b.Property("BattleY") + .HasColumnType("integer"); + + b.Property("CoalitionId") + .HasColumnType("integer"); + + b.Property("CombatType") + .HasColumnType("integer"); + + b.Property("DefenderAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceId") + .HasColumnType("integer"); + + b.Property("DefenderAllianceId1") + .HasColumnType("integer"); + + b.Property("DefenderBowmenAfter") + .HasColumnType("bigint"); + + b.Property("DefenderBowmenBefore") + .HasColumnType("bigint"); + + b.Property("DefenderCasualties") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderDragonBonus") + .HasColumnType("double precision"); + + b.Property("DefenderDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("DefenderHadDragon") + .HasColumnType("boolean"); + + b.Property("DefenderHighestTroopTier") + .HasColumnType("integer"); + + b.Property("DefenderInfantryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderInfantryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderPlayerId") + .HasColumnType("integer"); + + b.Property("DefenderPlayerId1") + .HasColumnType("integer"); + + b.Property("DefenderPowerBefore") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeAfter") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeBefore") + .HasColumnType("bigint"); + + b.Property("DefenderWoundedTroops") + .HasColumnType("bigint"); + + b.Property("DetailedBattleReport") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("FoodTransferred") + .HasColumnType("bigint"); + + b.Property("ForestSpeedReduction") + .HasColumnType("double precision"); + + b.Property("InterceptionType") + .HasColumnType("integer"); + + b.Property("InterceptorPlayerId") + .HasColumnType("integer"); + + b.Property("InterceptorPlayerId1") + .HasColumnType("integer"); + + b.Property("IronTransferred") + .HasColumnType("bigint"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("KvKEventId") + .HasColumnType("integer"); + + b.Property("MarchArrivalTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MarchDurationSeconds") + .HasColumnType("integer"); + + b.Property("MarchStartTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MithrilTransferred") + .HasColumnType("bigint"); + + b.Property("Result") + .HasColumnType("integer"); + + b.Property("SilverTransferred") + .HasColumnType("bigint"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("UsedSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("WasFieldInterception") + .HasColumnType("boolean"); + + b.Property("WasInForestZone") + .HasColumnType("boolean"); + + b.Property("WasKvKBattle") + .HasColumnType("boolean"); + + b.Property("WoodTransferred") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AttackerAllianceId") + .HasDatabaseName("IX_CombatLogs_AttackerAllianceId"); + + b.HasIndex("AttackerAllianceId1"); + + b.HasIndex("AttackerPlayerId") + .HasDatabaseName("IX_CombatLogs_AttackerPlayerId"); + + b.HasIndex("AttackerPlayerId1"); + + b.HasIndex("DefenderAllianceId") + .HasDatabaseName("IX_CombatLogs_DefenderAllianceId"); + + b.HasIndex("DefenderAllianceId1"); + + b.HasIndex("DefenderPlayerId") + .HasDatabaseName("IX_CombatLogs_DefenderPlayerId"); + + b.HasIndex("DefenderPlayerId1"); + + b.HasIndex("InterceptorPlayerId") + .HasDatabaseName("IX_CombatLogs_InterceptorPlayerId"); + + b.HasIndex("InterceptorPlayerId1"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_CombatLogs_KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_CombatLogs_Timestamp"); + + b.HasIndex("KingdomId", "Timestamp") + .HasDatabaseName("IX_CombatLogs_Kingdom_Time"); + + b.ToTable("CombatLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptingNewPlayers") + .HasColumnType("boolean"); + + b.Property("AutoKickInactivePlayers") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("CurrentPowerRank") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EnableTaxSystem") + .HasColumnType("boolean"); + + b.Property("InactivityKickDays") + .HasColumnType("integer"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMerger") + .HasColumnType("boolean"); + + b.Property("IsInKvK") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKDraws") + .HasColumnType("integer"); + + b.Property("KvKHostAllianceId") + .HasColumnType("integer"); + + b.Property("KvKLosses") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastActivity") + .HasColumnType("timestamp with time zone"); + + b.Property("LastKvKDate") + .HasColumnType("timestamp with time zone"); + + b.Property("MaxPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1500); + + b.Property("MergerAvailableDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Number") + .HasColumnType("integer"); + + b.Property("TaxRate") + .HasColumnType("decimal(5,4)"); + + b.Property("TotalPower") + .HasColumnType("bigint"); + + b.Property("TotalTaxCollected") + .HasColumnType("decimal(18,2)"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .HasDatabaseName("IX_Kingdoms_Name"); + + b.HasIndex("Number") + .IsUnique() + .HasDatabaseName("IX_Kingdoms_Number"); + + b.ToTable("Kingdoms"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptAllianceInvites") + .HasColumnType("boolean"); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AttacksLost") + .HasColumnType("bigint"); + + b.Property("AttacksWon") + .HasColumnType("bigint"); + + b.Property("AutoUseSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("Biography") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BowmenT1") + .HasColumnType("bigint"); + + b.Property("BowmenT10") + .HasColumnType("bigint"); + + b.Property("BowmenT11") + .HasColumnType("bigint"); + + b.Property("BowmenT12") + .HasColumnType("bigint"); + + b.Property("BowmenT13") + .HasColumnType("bigint"); + + b.Property("BowmenT2") + .HasColumnType("bigint"); + + b.Property("BowmenT3") + .HasColumnType("bigint"); + + b.Property("BowmenT4") + .HasColumnType("bigint"); + + b.Property("BowmenT5") + .HasColumnType("bigint"); + + b.Property("CastleLevel") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("CavalryT1") + .HasColumnType("bigint"); + + b.Property("CavalryT10") + .HasColumnType("bigint"); + + b.Property("CavalryT11") + .HasColumnType("bigint"); + + b.Property("CavalryT12") + .HasColumnType("bigint"); + + b.Property("CavalryT13") + .HasColumnType("bigint"); + + b.Property("CavalryT2") + .HasColumnType("bigint"); + + b.Property("CavalryT3") + .HasColumnType("bigint"); + + b.Property("CavalryT4") + .HasColumnType("bigint"); + + b.Property("CavalryT5") + .HasColumnType("bigint"); + + b.Property("CoordinateX") + .HasColumnType("integer"); + + b.Property("CoordinateY") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("DefensesLost") + .HasColumnType("bigint"); + + b.Property("DefensesWon") + .HasColumnType("bigint"); + + b.Property("DragonExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("EnablePushNotifications") + .HasColumnType("boolean"); + + b.Property("Food") + .HasColumnType("bigint"); + + b.Property("FoodProtected") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("integer"); + + b.Property("HasActiveDragon") + .HasColumnType("boolean"); + + b.Property("InfantryT1") + .HasColumnType("bigint"); + + b.Property("InfantryT10") + .HasColumnType("bigint"); + + b.Property("InfantryT11") + .HasColumnType("bigint"); + + b.Property("InfantryT12") + .HasColumnType("bigint"); + + b.Property("InfantryT13") + .HasColumnType("bigint"); + + b.Property("InfantryT2") + .HasColumnType("bigint"); + + b.Property("InfantryT3") + .HasColumnType("bigint"); + + b.Property("InfantryT4") + .HasColumnType("bigint"); + + b.Property("InfantryT5") + .HasColumnType("bigint"); + + b.Property("Iron") + .HasColumnType("bigint"); + + b.Property("IronProtected") + .HasColumnType("bigint"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("LastActiveAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("Mithril") + .HasColumnType("bigint"); + + b.Property("MithrilProtected") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesRaided") + .HasColumnType("bigint"); + + b.Property("ShowOnlineStatus") + .HasColumnType("boolean"); + + b.Property("SiegeT1") + .HasColumnType("bigint"); + + b.Property("SiegeT10") + .HasColumnType("bigint"); + + b.Property("SiegeT11") + .HasColumnType("bigint"); + + b.Property("SiegeT12") + .HasColumnType("bigint"); + + b.Property("SiegeT13") + .HasColumnType("bigint"); + + b.Property("SiegeT2") + .HasColumnType("bigint"); + + b.Property("SiegeT3") + .HasColumnType("bigint"); + + b.Property("SiegeT4") + .HasColumnType("bigint"); + + b.Property("SiegeT5") + .HasColumnType("bigint"); + + b.Property("Silver") + .HasColumnType("bigint"); + + b.Property("SilverProtected") + .HasColumnType("bigint"); + + b.Property("TroopsKilled") + .HasColumnType("bigint"); + + b.Property("TroopsLost") + .HasColumnType("bigint"); + + b.Property("VipExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("VipLevel") + .HasColumnType("integer"); + + b.Property("Wood") + .HasColumnType("bigint"); + + b.Property("WoodProtected") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_Players_AllianceId"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_Players_KingdomId"); + + b.HasIndex("Name") + .HasDatabaseName("IX_Players_Name"); + + b.HasIndex("Power") + .HasDatabaseName("IX_Players_Power"); + + b.HasIndex("KingdomId", "AllianceId") + .HasDatabaseName("IX_Players_Kingdom_Alliance"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Players_Kingdom_Power"); + + b.ToTable("Players"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AllianceId1") + .HasColumnType("integer"); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("BoostHours") + .HasColumnType("integer"); + + b.Property("BoostPercentage") + .HasColumnType("integer"); + + b.Property("BundleContents") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BundleDiscountPercentage") + .HasColumnType("double precision"); + + b.Property("CampaignId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ChargebackAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputeDeadline") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputed") + .HasColumnType("boolean"); + + b.Property("ChargebackFee") + .HasColumnType("decimal(18,2)"); + + b.Property("ChargebackPenalty") + .HasColumnType("decimal(18,2)"); + + b.Property("ChargebackReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("DaysSinceLastPurchase") + .HasColumnType("integer"); + + b.Property("DetailedPurchaseData") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("DeviceInfo") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DisputeStatus") + .HasColumnType("integer"); + + b.Property("DragonDaysAdded") + .HasColumnType("integer"); + + b.Property("DragonSkillsUnlocked") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("DragonType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("FoodReceived") + .HasColumnType("bigint"); + + b.Property("FraudNotes") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("FraudReason") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("FraudScore") + .HasColumnType("integer"); + + b.Property("GoldBalanceAfter") + .HasColumnType("integer"); + + b.Property("GoldBalanceBefore") + .HasColumnType("integer"); + + b.Property("GoldPurchased") + .HasColumnType("integer"); + + b.Property("GoldSpent") + .HasColumnType("integer"); + + b.Property("HasSkillBasedAlternative") + .HasColumnType("boolean"); + + b.Property("IPAddress") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("IronReceived") + .HasColumnType("bigint"); + + b.Property("IsBundle") + .HasColumnType("boolean"); + + b.Property("IsChargedBack") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsConstructionBoost") + .HasColumnType("boolean"); + + b.Property("IsDragonPurchase") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMonthlyReward") + .HasColumnType("boolean"); + + b.Property("IsEligibleForYearlyReward") + .HasColumnType("boolean"); + + b.Property("IsFirstMonthlyPurchase") + .HasColumnType("boolean"); + + b.Property("IsFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsFraudSuspected") + .HasColumnType("boolean"); + + b.Property("IsHighRiskTransaction") + .HasColumnType("boolean"); + + b.Property("IsNewDevicePurchase") + .HasColumnType("boolean"); + + b.Property("IsRefunded") + .HasColumnType("boolean"); + + b.Property("IsResearchBoost") + .HasColumnType("boolean"); + + b.Property("IsResourcePackage") + .HasColumnType("boolean"); + + b.Property("IsSpeedBoostPurchase") + .HasColumnType("boolean"); + + b.Property("IsStealthPurchase") + .HasColumnType("boolean"); + + b.Property("IsSuspicious") + .HasColumnType("boolean"); + + b.Property("IsTrainingBoost") + .HasColumnType("boolean"); + + b.Property("IsVelocityFlagged") + .HasColumnType("boolean"); + + b.Property("IsVipPurchase") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("LifetimePurchaseCount") + .HasColumnType("integer"); + + b.Property("LifetimeSpendingAfter") + .HasColumnType("decimal(18,2)"); + + b.Property("LifetimeSpendingBefore") + .HasColumnType("decimal(18,2)"); + + b.Property("MinutesFromRegistration") + .HasColumnType("integer"); + + b.Property("MithrilReceived") + .HasColumnType("bigint"); + + b.Property("MonthlyPurchaseCount") + .HasColumnType("integer"); + + b.Property("MonthlySpendingAfter") + .HasColumnType("decimal(18,2)"); + + b.Property("MonthlySpendingBefore") + .HasColumnType("decimal(18,2)"); + + b.Property("NetRevenue") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("Platform") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("PlatformFee") + .HasColumnType("decimal(18,2)"); + + b.Property("PlatformReceiptData") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("PlatformTransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PlatformUserId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("PlayerId1") + .HasColumnType("integer"); + + b.Property("ProcessedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ProductName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PromotionCode") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PurchaseDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("PurchaseNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PurchaseType") + .HasColumnType("integer"); + + b.Property("PurchasesInLast24Hours") + .HasColumnType("integer"); + + b.Property("RefundAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("RefundDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RefundReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("RefundedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RequiresManualReview") + .HasColumnType("boolean"); + + b.Property("SecretSpendingTierAfter") + .HasColumnType("integer"); + + b.Property("SecretSpendingTierBefore") + .HasColumnType("integer"); + + b.Property("SilverReceived") + .HasColumnType("bigint"); + + b.Property("SkillAlternativeDescription") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SkillAlternativeUsed") + .HasColumnType("double precision"); + + b.Property("SpeedBoostHours") + .HasColumnType("integer"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("SpeedBoostQuantity") + .HasColumnType("integer"); + + b.Property("SpendingInLast24Hours") + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StealthType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("StealthUsesAdded") + .HasColumnType("integer"); + + b.Property("TaxAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TimeInvestmentHours") + .HasColumnType("decimal(8,2)"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("TriggeredVipMilestone") + .HasColumnType("boolean"); + + b.Property("UnlockedNewSecretTier") + .HasColumnType("boolean"); + + b.Property("UserAgent") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("VipDaysAdded") + .HasColumnType("integer"); + + b.Property("VipLevelAfter") + .HasColumnType("integer"); + + b.Property("VipLevelBefore") + .HasColumnType("integer"); + + b.Property("VipMilestoneReached") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("VipPointsAfter") + .HasColumnType("integer"); + + b.Property("VipPointsBefore") + .HasColumnType("integer"); + + b.Property("VipPointsEarned") + .HasColumnType("integer"); + + b.Property("WasChargeback") + .HasColumnType("boolean"); + + b.Property("WasRefunded") + .HasColumnType("boolean"); + + b.Property("WoodReceived") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_PurchaseLogs_AllianceId"); + + b.HasIndex("AllianceId1"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_PurchaseLogs_KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("PlayerId") + .HasDatabaseName("IX_PurchaseLogs_PlayerId"); + + b.HasIndex("PlayerId1"); + + b.HasIndex("PurchaseDate") + .HasDatabaseName("IX_PurchaseLogs_PurchaseDate"); + + b.HasIndex("TransactionId") + .HasDatabaseName("IX_PurchaseLogs_TransactionId"); + + b.HasIndex("KingdomId", "PurchaseDate") + .HasDatabaseName("IX_PurchaseLogs_Kingdom_Time"); + + b.ToTable("PurchaseLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Data.Contexts.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LastLoginAt") + .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("PlayerId") + .HasColumnType("integer"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Players_Auth", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Alliances") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_Alliances_Kingdoms_KingdomId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Leader") + .WithOne() + .HasForeignKey("ShadowedRealms.Core.Models.Alliance.Alliance", "LeaderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_Alliances_Players_LeaderId"); + + b.Navigation("Kingdom"); + + b.Navigation("Leader"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("PendingInvitations") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceInvitation_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InvitedBy") + .WithMany() + .HasForeignKey("InvitedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceInvitation_Players_InvitedById"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceInvitation_Players_PlayerId"); + + b.Navigation("Alliance"); + + b.Navigation("InvitedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Roles") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceRole_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AssignedBy") + .WithMany() + .HasForeignKey("AssignedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceRole_Players_AssignedById"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceRole_Players_PlayerId"); + + b.Navigation("Alliance"); + + b.Navigation("AssignedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", null) + .WithMany() + .HasForeignKey("AttackerAllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_CombatLogs_Alliances_AttackerAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "AttackerAlliance") + .WithMany() + .HasForeignKey("AttackerAllianceId1"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("AttackerPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_CombatLogs_Players_AttackerPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AttackerPlayer") + .WithMany() + .HasForeignKey("AttackerPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", null) + .WithMany() + .HasForeignKey("DefenderAllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_CombatLogs_Alliances_DefenderAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "DefenderAlliance") + .WithMany() + .HasForeignKey("DefenderAllianceId1"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("DefenderPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_CombatLogs_Players_DefenderPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "DefenderPlayer") + .WithMany() + .HasForeignKey("DefenderPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("InterceptorPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_CombatLogs_Players_InterceptorPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InterceptorPlayer") + .WithMany() + .HasForeignKey("InterceptorPlayerId1"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_CombatLogs_Kingdoms_KingdomId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AttackerAlliance"); + + b.Navigation("AttackerPlayer"); + + b.Navigation("DefenderAlliance"); + + b.Navigation("DefenderPlayer"); + + b.Navigation("InterceptorPlayer"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Members") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_Players_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Players") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_Players_Kingdoms_KingdomId"); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", null) + .WithMany() + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_PurchaseLogs_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany() + .HasForeignKey("AllianceId1"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_PurchaseLogs_Kingdoms_KingdomId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_PurchaseLogs_Players_PlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Navigation("Members"); + + b.Navigation("PendingInvitations"); + + b.Navigation("Roles"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Navigation("Alliances"); + + b.Navigation("Players"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.cs new file mode 100644 index 0000000..b862d08 --- /dev/null +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/20251029203255_FixEFCoreWarnings.cs @@ -0,0 +1,1086 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace ShadowedRealms.Data.Migrations +{ + /// + public partial class FixEFCoreWarnings : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Kingdoms", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Number = table.Column(type: "integer", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + MaxPopulation = table.Column(type: "integer", nullable: false, defaultValue: 1500), + CurrentPopulation = table.Column(type: "integer", nullable: false, defaultValue: 0), + TotalPower = table.Column(type: "bigint", nullable: false), + LastKvKDate = table.Column(type: "timestamp with time zone", nullable: true), + KvKWins = table.Column(type: "integer", nullable: false), + KvKLosses = table.Column(type: "integer", nullable: false), + KvKDraws = table.Column(type: "integer", nullable: false), + IsEligibleForKvK = table.Column(type: "boolean", nullable: false), + AcceptingNewPlayers = table.Column(type: "boolean", nullable: false), + MergerAvailableDate = table.Column(type: "timestamp with time zone", nullable: true), + IsEligibleForMerger = table.Column(type: "boolean", nullable: false), + Description = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + WelcomeMessage = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + AutoKickInactivePlayers = table.Column(type: "boolean", nullable: false), + InactivityKickDays = table.Column(type: "integer", nullable: false), + EnableTaxSystem = table.Column(type: "boolean", nullable: false), + TaxRate = table.Column(type: "numeric(5,4)", nullable: false), + LastActivity = table.Column(type: "timestamp with time zone", nullable: false), + TotalTaxCollected = table.Column(type: "numeric(18,2)", nullable: false), + IsInKvK = table.Column(type: "boolean", nullable: false), + KvKHostAllianceId = table.Column(type: "integer", nullable: true), + CurrentPowerRank = table.Column(type: "integer", nullable: false), + KingdomId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Kingdoms", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Players_Auth", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PlayerId = table.Column(type: "integer", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + LastLoginAt = table.Column(type: "timestamp with time zone", nullable: false), + UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + EmailConfirmed = table.Column(type: "boolean", nullable: false), + PasswordHash = table.Column(type: "text", nullable: true), + SecurityStamp = table.Column(type: "text", nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true), + PhoneNumber = table.Column(type: "text", nullable: true), + PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), + TwoFactorEnabled = table.Column(type: "boolean", nullable: false), + LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), + LockoutEnabled = table.Column(type: "boolean", nullable: false), + AccessFailedCount = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Players_Auth", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Roles", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), + ConcurrencyStamp = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Roles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Player_Claims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + UserId = table.Column(type: "integer", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Claims", x => x.Id); + table.ForeignKey( + name: "FK_Player_Claims_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Player_Logins", + columns: table => new + { + LoginProvider = table.Column(type: "text", nullable: false), + ProviderKey = table.Column(type: "text", nullable: false), + ProviderDisplayName = table.Column(type: "text", nullable: true), + UserId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Logins", x => new { x.LoginProvider, x.ProviderKey }); + table.ForeignKey( + name: "FK_Player_Logins_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Player_Tokens", + columns: table => new + { + UserId = table.Column(type: "integer", nullable: false), + LoginProvider = table.Column(type: "text", nullable: false), + Name = table.Column(type: "text", nullable: false), + Value = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Tokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_Player_Tokens_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Player_Roles", + columns: table => new + { + UserId = table.Column(type: "integer", nullable: false), + RoleId = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Player_Roles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_Player_Roles_Players_Auth_UserId", + column: x => x.UserId, + principalTable: "Players_Auth", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Player_Roles_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Role_Claims", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + RoleId = table.Column(type: "integer", nullable: false), + ClaimType = table.Column(type: "text", nullable: true), + ClaimValue = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Role_Claims", x => x.Id); + table.ForeignKey( + name: "FK_Role_Claims_Roles_RoleId", + column: x => x.RoleId, + principalTable: "Roles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AllianceInvitation", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AllianceId = table.Column(type: "integer", nullable: false), + PlayerId = table.Column(type: "integer", nullable: false), + InvitedById = table.Column(type: "integer", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + ExpiresAt = table.Column(type: "timestamp with time zone", nullable: false), + IsAccepted = table.Column(type: "boolean", nullable: false), + IsRejected = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AllianceInvitation", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AllianceRole", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AllianceId = table.Column(type: "integer", nullable: false), + PlayerId = table.Column(type: "integer", nullable: false), + Rank = table.Column(type: "integer", nullable: false), + AssignedAt = table.Column(type: "timestamp with time zone", nullable: false), + AssignedById = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AllianceRole", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Alliances", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + Tag = table.Column(type: "character varying(5)", maxLength: 5, nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + LeaderId = table.Column(type: "integer", nullable: false), + Level = table.Column(type: "integer", nullable: false, defaultValue: 1), + Power = table.Column(type: "bigint", nullable: false, defaultValue: 0L), + ExperiencePoints = table.Column(type: "bigint", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + MaxMembers = table.Column(type: "integer", nullable: false, defaultValue: 50), + Description = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + WelcomeMessage = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + IsOpenToJoin = table.Column(type: "boolean", nullable: false), + RequireApproval = table.Column(type: "boolean", nullable: false), + MinCastleLevelToJoin = table.Column(type: "integer", nullable: false), + MinPowerToJoin = table.Column(type: "bigint", nullable: false), + FortressX = table.Column(type: "integer", nullable: false), + FortressY = table.Column(type: "integer", nullable: false), + FortressLevel = table.Column(type: "integer", nullable: false), + TowerCount = table.Column(type: "integer", nullable: false), + ResourceBuildingCount = table.Column(type: "integer", nullable: false), + HasTerritory = table.Column(type: "boolean", nullable: false), + MilitaryAttackResearch = table.Column(type: "integer", nullable: false), + MilitaryDefenseResearch = table.Column(type: "integer", nullable: false), + MilitaryHealthResearch = table.Column(type: "integer", nullable: false), + MilitarySpeedResearch = table.Column(type: "integer", nullable: false), + MilitaryCapacityResearch = table.Column(type: "integer", nullable: false), + EconomicGatheringResearch = table.Column(type: "integer", nullable: false), + EconomicStorageResearch = table.Column(type: "integer", nullable: false), + EconomicTradeResearch = table.Column(type: "integer", nullable: false), + EconomicProductionResearch = table.Column(type: "integer", nullable: false), + EconomicTaxationResearch = table.Column(type: "integer", nullable: false), + TechnologyConstructionResearch = table.Column(type: "integer", nullable: false), + TechnologyUpgradeResearch = table.Column(type: "integer", nullable: false), + TechnologyTrainingResearch = table.Column(type: "integer", nullable: false), + TechnologyResearchResearch = table.Column(type: "integer", nullable: false), + TechnologyHealingResearch = table.Column(type: "integer", nullable: false), + TotalKills = table.Column(type: "bigint", nullable: false), + TotalDeaths = table.Column(type: "bigint", nullable: false), + ResourcesGathered = table.Column(type: "bigint", nullable: false), + ResourcesShared = table.Column(type: "bigint", nullable: false), + KvKParticipations = table.Column(type: "integer", nullable: false), + KvKWins = table.Column(type: "integer", nullable: false), + LastKvKParticipation = table.Column(type: "timestamp with time zone", nullable: true), + CurrentCoalitionId = table.Column(type: "integer", nullable: true), + IsEligibleForKvK = table.Column(type: "boolean", nullable: false), + AcceptsCoalitionInvites = table.Column(type: "boolean", nullable: false), + CoalitionReputationScore = table.Column(type: "integer", nullable: false), + TreasuryFood = table.Column(type: "bigint", nullable: false), + TreasuryWood = table.Column(type: "bigint", nullable: false), + TreasuryIron = table.Column(type: "bigint", nullable: false), + TreasurySilver = table.Column(type: "bigint", nullable: false), + TreasuryMithril = table.Column(type: "bigint", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Alliances", x => x.Id); + table.ForeignKey( + name: "FK_Alliances_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Players", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + AllianceId = table.Column(type: "integer", nullable: true), + CastleLevel = table.Column(type: "integer", nullable: false, defaultValue: 1), + Power = table.Column(type: "bigint", nullable: false, defaultValue: 0L), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + LastActiveAt = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + IsActive = table.Column(type: "boolean", nullable: false, defaultValue: true), + CoordinateX = table.Column(type: "integer", nullable: false), + CoordinateY = table.Column(type: "integer", nullable: false), + Food = table.Column(type: "bigint", nullable: false), + Wood = table.Column(type: "bigint", nullable: false), + Iron = table.Column(type: "bigint", nullable: false), + Silver = table.Column(type: "bigint", nullable: false), + Mithril = table.Column(type: "bigint", nullable: false), + FoodProtected = table.Column(type: "bigint", nullable: false), + WoodProtected = table.Column(type: "bigint", nullable: false), + IronProtected = table.Column(type: "bigint", nullable: false), + SilverProtected = table.Column(type: "bigint", nullable: false), + MithrilProtected = table.Column(type: "bigint", nullable: false), + Gold = table.Column(type: "integer", nullable: false), + InfantryT1 = table.Column(type: "bigint", nullable: false), + CavalryT1 = table.Column(type: "bigint", nullable: false), + BowmenT1 = table.Column(type: "bigint", nullable: false), + SiegeT1 = table.Column(type: "bigint", nullable: false), + InfantryT2 = table.Column(type: "bigint", nullable: false), + CavalryT2 = table.Column(type: "bigint", nullable: false), + BowmenT2 = table.Column(type: "bigint", nullable: false), + SiegeT2 = table.Column(type: "bigint", nullable: false), + InfantryT3 = table.Column(type: "bigint", nullable: false), + CavalryT3 = table.Column(type: "bigint", nullable: false), + BowmenT3 = table.Column(type: "bigint", nullable: false), + SiegeT3 = table.Column(type: "bigint", nullable: false), + InfantryT4 = table.Column(type: "bigint", nullable: false), + CavalryT4 = table.Column(type: "bigint", nullable: false), + BowmenT4 = table.Column(type: "bigint", nullable: false), + SiegeT4 = table.Column(type: "bigint", nullable: false), + InfantryT5 = table.Column(type: "bigint", nullable: false), + CavalryT5 = table.Column(type: "bigint", nullable: false), + BowmenT5 = table.Column(type: "bigint", nullable: false), + SiegeT5 = table.Column(type: "bigint", nullable: false), + InfantryT10 = table.Column(type: "bigint", nullable: false), + CavalryT10 = table.Column(type: "bigint", nullable: false), + BowmenT10 = table.Column(type: "bigint", nullable: false), + SiegeT10 = table.Column(type: "bigint", nullable: false), + InfantryT11 = table.Column(type: "bigint", nullable: false), + CavalryT11 = table.Column(type: "bigint", nullable: false), + BowmenT11 = table.Column(type: "bigint", nullable: false), + SiegeT11 = table.Column(type: "bigint", nullable: false), + InfantryT12 = table.Column(type: "bigint", nullable: false), + CavalryT12 = table.Column(type: "bigint", nullable: false), + BowmenT12 = table.Column(type: "bigint", nullable: false), + SiegeT12 = table.Column(type: "bigint", nullable: false), + InfantryT13 = table.Column(type: "bigint", nullable: false), + CavalryT13 = table.Column(type: "bigint", nullable: false), + BowmenT13 = table.Column(type: "bigint", nullable: false), + SiegeT13 = table.Column(type: "bigint", nullable: false), + AttacksWon = table.Column(type: "bigint", nullable: false), + AttacksLost = table.Column(type: "bigint", nullable: false), + DefensesWon = table.Column(type: "bigint", nullable: false), + DefensesLost = table.Column(type: "bigint", nullable: false), + TroopsKilled = table.Column(type: "bigint", nullable: false), + TroopsLost = table.Column(type: "bigint", nullable: false), + ResourcesGathered = table.Column(type: "bigint", nullable: false), + ResourcesRaided = table.Column(type: "bigint", nullable: false), + AcceptAllianceInvites = table.Column(type: "boolean", nullable: false), + ShowOnlineStatus = table.Column(type: "boolean", nullable: false), + EnablePushNotifications = table.Column(type: "boolean", nullable: false), + AutoUseSpeedBoosts = table.Column(type: "boolean", nullable: false), + Biography = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + VipLevel = table.Column(type: "integer", nullable: false), + VipExpiryDate = table.Column(type: "timestamp with time zone", nullable: true), + HasActiveDragon = table.Column(type: "boolean", nullable: false), + DragonExpiryDate = table.Column(type: "timestamp with time zone", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Players", x => x.Id); + table.ForeignKey( + name: "FK_Players_Alliances_AllianceId", + column: x => x.AllianceId, + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_Players_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "CombatLogs", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + AttackerPlayerId = table.Column(type: "integer", nullable: false), + DefenderPlayerId = table.Column(type: "integer", nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + AttackerAllianceId = table.Column(type: "integer", nullable: true), + DefenderAllianceId = table.Column(type: "integer", nullable: true), + CombatType = table.Column(type: "integer", nullable: false), + Result = table.Column(type: "integer", nullable: false), + Timestamp = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + BattleX = table.Column(type: "integer", nullable: false), + BattleY = table.Column(type: "integer", nullable: false), + WasFieldInterception = table.Column(type: "boolean", nullable: false), + InterceptorPlayerId = table.Column(type: "integer", nullable: true), + InterceptionType = table.Column(type: "integer", nullable: true), + MarchStartTime = table.Column(type: "timestamp with time zone", nullable: false), + MarchArrivalTime = table.Column(type: "timestamp with time zone", nullable: false), + MarchDurationSeconds = table.Column(type: "integer", nullable: false), + UsedSpeedBoosts = table.Column(type: "boolean", nullable: false), + SpeedBoostLevel = table.Column(type: "integer", nullable: false), + AttackerInfantryBefore = table.Column(type: "bigint", nullable: false), + AttackerCavalryBefore = table.Column(type: "bigint", nullable: false), + AttackerBowmenBefore = table.Column(type: "bigint", nullable: false), + AttackerSiegeBefore = table.Column(type: "bigint", nullable: false), + AttackerHighestTroopTier = table.Column(type: "integer", nullable: false), + AttackerInfantryAfter = table.Column(type: "bigint", nullable: false), + AttackerCavalryAfter = table.Column(type: "bigint", nullable: false), + AttackerBowmenAfter = table.Column(type: "bigint", nullable: false), + AttackerSiegeAfter = table.Column(type: "bigint", nullable: false), + DefenderInfantryBefore = table.Column(type: "bigint", nullable: false), + DefenderCavalryBefore = table.Column(type: "bigint", nullable: false), + DefenderBowmenBefore = table.Column(type: "bigint", nullable: false), + DefenderSiegeBefore = table.Column(type: "bigint", nullable: false), + DefenderHighestTroopTier = table.Column(type: "integer", nullable: false), + DefenderInfantryAfter = table.Column(type: "bigint", nullable: false), + DefenderCavalryAfter = table.Column(type: "bigint", nullable: false), + DefenderBowmenAfter = table.Column(type: "bigint", nullable: false), + DefenderSiegeAfter = table.Column(type: "bigint", nullable: false), + AttackerPowerBefore = table.Column(type: "bigint", nullable: false), + DefenderPowerBefore = table.Column(type: "bigint", nullable: false), + AttackerCasualties = table.Column(type: "bigint", nullable: false), + DefenderCasualties = table.Column(type: "bigint", nullable: false), + AttackerWoundedTroops = table.Column(type: "bigint", nullable: false), + DefenderWoundedTroops = table.Column(type: "bigint", nullable: false), + AttackerHadDragon = table.Column(type: "boolean", nullable: false), + DefenderHadDragon = table.Column(type: "boolean", nullable: false), + AttackerDragonSkillsUsed = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + DefenderDragonSkillsUsed = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + AttackerDragonBonus = table.Column(type: "double precision", nullable: false), + DefenderDragonBonus = table.Column(type: "double precision", nullable: false), + FoodTransferred = table.Column(type: "bigint", nullable: false), + WoodTransferred = table.Column(type: "bigint", nullable: false), + IronTransferred = table.Column(type: "bigint", nullable: false), + SilverTransferred = table.Column(type: "bigint", nullable: false), + MithrilTransferred = table.Column(type: "bigint", nullable: false), + AttackerAllianceAttackBonus = table.Column(type: "double precision", nullable: false), + AttackerAllianceDefenseBonus = table.Column(type: "double precision", nullable: false), + AttackerAllianceHealthBonus = table.Column(type: "double precision", nullable: false), + DefenderAllianceAttackBonus = table.Column(type: "double precision", nullable: false), + DefenderAllianceDefenseBonus = table.Column(type: "double precision", nullable: false), + DefenderAllianceHealthBonus = table.Column(type: "double precision", nullable: false), + WasKvKBattle = table.Column(type: "boolean", nullable: false), + KvKEventId = table.Column(type: "integer", nullable: true), + CoalitionId = table.Column(type: "integer", nullable: true), + WasInForestZone = table.Column(type: "boolean", nullable: false), + ForestSpeedReduction = table.Column(type: "double precision", nullable: false), + DetailedBattleReport = table.Column(type: "character varying(4000)", maxLength: 4000, nullable: true), + BattleNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + AttackerPlayerId1 = table.Column(type: "integer", nullable: false), + DefenderPlayerId1 = table.Column(type: "integer", nullable: false), + KingdomId1 = table.Column(type: "integer", nullable: false), + AttackerAllianceId1 = table.Column(type: "integer", nullable: true), + DefenderAllianceId1 = table.Column(type: "integer", nullable: true), + InterceptorPlayerId1 = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_CombatLogs", x => x.Id); + table.ForeignKey( + name: "FK_CombatLogs_Alliances_AttackerAllianceId", + column: x => x.AttackerAllianceId, + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_CombatLogs_Alliances_AttackerAllianceId1", + column: x => x.AttackerAllianceId1, + principalTable: "Alliances", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CombatLogs_Alliances_DefenderAllianceId", + column: x => x.DefenderAllianceId, + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_CombatLogs_Alliances_DefenderAllianceId1", + column: x => x.DefenderAllianceId1, + principalTable: "Alliances", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_CombatLogs_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Kingdoms_KingdomId1", + column: x => x.KingdomId1, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CombatLogs_Players_AttackerPlayerId", + column: x => x.AttackerPlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Players_AttackerPlayerId1", + column: x => x.AttackerPlayerId1, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CombatLogs_Players_DefenderPlayerId", + column: x => x.DefenderPlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Players_DefenderPlayerId1", + column: x => x.DefenderPlayerId1, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CombatLogs_Players_InterceptorPlayerId", + column: x => x.InterceptorPlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_CombatLogs_Players_InterceptorPlayerId1", + column: x => x.InterceptorPlayerId1, + principalTable: "Players", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "PurchaseLogs", + columns: table => new + { + Id = table.Column(type: "integer", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + PlayerId = table.Column(type: "integer", nullable: false), + KingdomId = table.Column(type: "integer", nullable: false), + AllianceId = table.Column(type: "integer", nullable: true), + ProductId = table.Column(type: "character varying(100)", maxLength: 100, nullable: false), + ProductName = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + PurchaseType = table.Column(type: "integer", nullable: false), + PaymentMethod = table.Column(type: "integer", nullable: false), + Amount = table.Column(type: "numeric(18,2)", nullable: false), + Currency = table.Column(type: "character varying(10)", maxLength: 10, nullable: false), + PurchaseDate = table.Column(type: "timestamp with time zone", nullable: false, defaultValueSql: "CURRENT_TIMESTAMP"), + ProcessedAt = table.Column(type: "timestamp with time zone", nullable: true), + Status = table.Column(type: "integer", nullable: false), + TransactionId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + PlatformTransactionId = table.Column(type: "character varying(200)", maxLength: 200, nullable: false), + PlatformReceiptData = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + Platform = table.Column(type: "character varying(20)", maxLength: 20, nullable: false), + PlatformUserId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + DeviceInfo = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + IPAddress = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + UserAgent = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + GoldPurchased = table.Column(type: "integer", nullable: false), + GoldSpent = table.Column(type: "integer", nullable: false), + GoldBalanceBefore = table.Column(type: "integer", nullable: false), + GoldBalanceAfter = table.Column(type: "integer", nullable: false), + PlatformFee = table.Column(type: "numeric(18,2)", nullable: false), + NetRevenue = table.Column(type: "numeric(18,2)", nullable: false), + TaxAmount = table.Column(type: "numeric(18,2)", nullable: false), + RefundAmount = table.Column(type: "numeric(18,2)", nullable: false), + IsChargedBack = table.Column(type: "boolean", nullable: false), + ChargebackDate = table.Column(type: "timestamp with time zone", nullable: true), + ChargebackReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + ChargebackPenalty = table.Column(type: "numeric(18,2)", nullable: true), + IsSuspicious = table.Column(type: "boolean", nullable: false), + FraudReason = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + IsRefunded = table.Column(type: "boolean", nullable: false), + RefundDate = table.Column(type: "timestamp with time zone", nullable: true), + RefundReason = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + IsConfirmed = table.Column(type: "boolean", nullable: false), + Notes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + IsVipPurchase = table.Column(type: "boolean", nullable: false), + VipLevelBefore = table.Column(type: "integer", nullable: false), + VipLevelAfter = table.Column(type: "integer", nullable: false), + VipDaysAdded = table.Column(type: "integer", nullable: false), + VipPointsEarned = table.Column(type: "integer", nullable: false), + VipPointsBefore = table.Column(type: "integer", nullable: false), + VipPointsAfter = table.Column(type: "integer", nullable: false), + TriggeredVipMilestone = table.Column(type: "boolean", nullable: false), + VipMilestoneReached = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + IsEligibleForMonthlyReward = table.Column(type: "boolean", nullable: false), + IsEligibleForYearlyReward = table.Column(type: "boolean", nullable: false), + SecretSpendingTierBefore = table.Column(type: "integer", nullable: false), + SecretSpendingTierAfter = table.Column(type: "integer", nullable: false), + UnlockedNewSecretTier = table.Column(type: "boolean", nullable: false), + IsDragonPurchase = table.Column(type: "boolean", nullable: false), + DragonType = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + DragonDaysAdded = table.Column(type: "integer", nullable: false), + DragonSkillsUnlocked = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + IsSpeedBoostPurchase = table.Column(type: "boolean", nullable: false), + SpeedBoostQuantity = table.Column(type: "integer", nullable: false), + SpeedBoostLevel = table.Column(type: "integer", nullable: false), + SpeedBoostHours = table.Column(type: "integer", nullable: false), + IsStealthPurchase = table.Column(type: "boolean", nullable: false), + StealthUsesAdded = table.Column(type: "integer", nullable: false), + StealthType = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + IsResourcePackage = table.Column(type: "boolean", nullable: false), + FoodReceived = table.Column(type: "bigint", nullable: false), + WoodReceived = table.Column(type: "bigint", nullable: false), + IronReceived = table.Column(type: "bigint", nullable: false), + SilverReceived = table.Column(type: "bigint", nullable: false), + MithrilReceived = table.Column(type: "bigint", nullable: false), + IsConstructionBoost = table.Column(type: "boolean", nullable: false), + IsTrainingBoost = table.Column(type: "boolean", nullable: false), + IsResearchBoost = table.Column(type: "boolean", nullable: false), + BoostHours = table.Column(type: "integer", nullable: false), + BoostPercentage = table.Column(type: "integer", nullable: false), + SkillAlternativeUsed = table.Column(type: "double precision", nullable: false), + HasSkillBasedAlternative = table.Column(type: "boolean", nullable: false), + SkillAlternativeDescription = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + TimeInvestmentHours = table.Column(type: "numeric(8,2)", nullable: false), + IsBundle = table.Column(type: "boolean", nullable: false), + BundleContents = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + BundleDiscountPercentage = table.Column(type: "double precision", nullable: false), + WasRefunded = table.Column(type: "boolean", nullable: false), + RefundedAt = table.Column(type: "timestamp with time zone", nullable: true), + WasChargeback = table.Column(type: "boolean", nullable: false), + ChargebackAt = table.Column(type: "timestamp with time zone", nullable: true), + ChargebackDisputeDeadline = table.Column(type: "timestamp with time zone", nullable: true), + ChargebackDisputed = table.Column(type: "boolean", nullable: false), + DisputeStatus = table.Column(type: "integer", nullable: true), + ChargebackFee = table.Column(type: "numeric(18,2)", nullable: false), + FraudScore = table.Column(type: "integer", nullable: false), + IsFraudSuspected = table.Column(type: "boolean", nullable: false), + FraudNotes = table.Column(type: "character varying(500)", maxLength: 500, nullable: true), + RequiresManualReview = table.Column(type: "boolean", nullable: false), + IsHighRiskTransaction = table.Column(type: "boolean", nullable: false), + MinutesFromRegistration = table.Column(type: "integer", nullable: false), + PurchasesInLast24Hours = table.Column(type: "integer", nullable: false), + SpendingInLast24Hours = table.Column(type: "numeric(18,2)", nullable: false), + IsVelocityFlagged = table.Column(type: "boolean", nullable: false), + IsNewDevicePurchase = table.Column(type: "boolean", nullable: false), + MonthlySpendingBefore = table.Column(type: "numeric(18,2)", nullable: false), + MonthlySpendingAfter = table.Column(type: "numeric(18,2)", nullable: false), + LifetimeSpendingBefore = table.Column(type: "numeric(18,2)", nullable: false), + LifetimeSpendingAfter = table.Column(type: "numeric(18,2)", nullable: false), + MonthlyPurchaseCount = table.Column(type: "integer", nullable: false), + LifetimePurchaseCount = table.Column(type: "integer", nullable: false), + DetailedPurchaseData = table.Column(type: "character varying(2000)", maxLength: 2000, nullable: true), + PurchaseNotes = table.Column(type: "character varying(1000)", maxLength: 1000, nullable: true), + CampaignId = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + PromotionCode = table.Column(type: "character varying(100)", maxLength: 100, nullable: true), + IsFirstPurchase = table.Column(type: "boolean", nullable: false), + IsFirstMonthlyPurchase = table.Column(type: "boolean", nullable: false), + DaysSinceLastPurchase = table.Column(type: "integer", nullable: false), + PlayerId1 = table.Column(type: "integer", nullable: false), + KingdomId1 = table.Column(type: "integer", nullable: false), + AllianceId1 = table.Column(type: "integer", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_PurchaseLogs", x => x.Id); + table.ForeignKey( + name: "FK_PurchaseLogs_Alliances_AllianceId", + column: x => x.AllianceId, + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_PurchaseLogs_Alliances_AllianceId1", + column: x => x.AllianceId1, + principalTable: "Alliances", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_PurchaseLogs_Kingdoms_KingdomId", + column: x => x.KingdomId, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PurchaseLogs_Kingdoms_KingdomId1", + column: x => x.KingdomId1, + principalTable: "Kingdoms", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PurchaseLogs_Players_PlayerId", + column: x => x.PlayerId, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_PurchaseLogs_Players_PlayerId1", + column: x => x.PlayerId1, + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AllianceInvitation_AllianceId", + table: "AllianceInvitation", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceInvitation_InvitedById", + table: "AllianceInvitation", + column: "InvitedById"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceInvitation_PlayerId", + table: "AllianceInvitation", + column: "PlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceRole_AllianceId", + table: "AllianceRole", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceRole_AssignedById", + table: "AllianceRole", + column: "AssignedById"); + + migrationBuilder.CreateIndex( + name: "IX_AllianceRole_PlayerId", + table: "AllianceRole", + column: "PlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Kingdom_Power", + table: "Alliances", + columns: new[] { "KingdomId", "Power" }); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_KingdomId", + table: "Alliances", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_LeaderId", + table: "Alliances", + column: "LeaderId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Name", + table: "Alliances", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Power", + table: "Alliances", + column: "Power"); + + migrationBuilder.CreateIndex( + name: "IX_Alliances_Tag", + table: "Alliances", + column: "Tag"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerAllianceId", + table: "CombatLogs", + column: "AttackerAllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerAllianceId1", + table: "CombatLogs", + column: "AttackerAllianceId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerPlayerId", + table: "CombatLogs", + column: "AttackerPlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_AttackerPlayerId1", + table: "CombatLogs", + column: "AttackerPlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderAllianceId", + table: "CombatLogs", + column: "DefenderAllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderAllianceId1", + table: "CombatLogs", + column: "DefenderAllianceId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderPlayerId", + table: "CombatLogs", + column: "DefenderPlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_DefenderPlayerId1", + table: "CombatLogs", + column: "DefenderPlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_InterceptorPlayerId", + table: "CombatLogs", + column: "InterceptorPlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_InterceptorPlayerId1", + table: "CombatLogs", + column: "InterceptorPlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_Kingdom_Time", + table: "CombatLogs", + columns: new[] { "KingdomId", "Timestamp" }); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_KingdomId", + table: "CombatLogs", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_KingdomId1", + table: "CombatLogs", + column: "KingdomId1"); + + migrationBuilder.CreateIndex( + name: "IX_CombatLogs_Timestamp", + table: "CombatLogs", + column: "Timestamp"); + + migrationBuilder.CreateIndex( + name: "IX_Kingdoms_Name", + table: "Kingdoms", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Kingdoms_Number", + table: "Kingdoms", + column: "Number", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Player_Claims_UserId", + table: "Player_Claims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Player_Logins_UserId", + table: "Player_Logins", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_Player_Roles_RoleId", + table: "Player_Roles", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_Players_AllianceId", + table: "Players", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_Players_Kingdom_Alliance", + table: "Players", + columns: new[] { "KingdomId", "AllianceId" }); + + migrationBuilder.CreateIndex( + name: "IX_Players_Kingdom_Power", + table: "Players", + columns: new[] { "KingdomId", "Power" }); + + migrationBuilder.CreateIndex( + name: "IX_Players_KingdomId", + table: "Players", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_Players_Name", + table: "Players", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_Players_Power", + table: "Players", + column: "Power"); + + migrationBuilder.CreateIndex( + name: "EmailIndex", + table: "Players_Auth", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "UserNameIndex", + table: "Players_Auth", + column: "NormalizedUserName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_AllianceId", + table: "PurchaseLogs", + column: "AllianceId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_AllianceId1", + table: "PurchaseLogs", + column: "AllianceId1"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_Kingdom_Time", + table: "PurchaseLogs", + columns: new[] { "KingdomId", "PurchaseDate" }); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_KingdomId", + table: "PurchaseLogs", + column: "KingdomId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_KingdomId1", + table: "PurchaseLogs", + column: "KingdomId1"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_PlayerId", + table: "PurchaseLogs", + column: "PlayerId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_PlayerId1", + table: "PurchaseLogs", + column: "PlayerId1"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_PurchaseDate", + table: "PurchaseLogs", + column: "PurchaseDate"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseLogs_TransactionId", + table: "PurchaseLogs", + column: "TransactionId"); + + migrationBuilder.CreateIndex( + name: "IX_Role_Claims_RoleId", + table: "Role_Claims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "RoleNameIndex", + table: "Roles", + column: "NormalizedName", + unique: true); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceInvitation_Alliances_AllianceId", + table: "AllianceInvitation", + column: "AllianceId", + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceInvitation_Players_InvitedById", + table: "AllianceInvitation", + column: "InvitedById", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceInvitation_Players_PlayerId", + table: "AllianceInvitation", + column: "PlayerId", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceRole_Alliances_AllianceId", + table: "AllianceRole", + column: "AllianceId", + principalTable: "Alliances", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceRole_Players_AssignedById", + table: "AllianceRole", + column: "AssignedById", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_AllianceRole_Players_PlayerId", + table: "AllianceRole", + column: "PlayerId", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + + migrationBuilder.AddForeignKey( + name: "FK_Alliances_Players_LeaderId", + table: "Alliances", + column: "LeaderId", + principalTable: "Players", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Players_Alliances_AllianceId", + table: "Players"); + + migrationBuilder.DropTable( + name: "AllianceInvitation"); + + migrationBuilder.DropTable( + name: "AllianceRole"); + + migrationBuilder.DropTable( + name: "CombatLogs"); + + migrationBuilder.DropTable( + name: "Player_Claims"); + + migrationBuilder.DropTable( + name: "Player_Logins"); + + migrationBuilder.DropTable( + name: "Player_Roles"); + + migrationBuilder.DropTable( + name: "Player_Tokens"); + + migrationBuilder.DropTable( + name: "PurchaseLogs"); + + migrationBuilder.DropTable( + name: "Role_Claims"); + + migrationBuilder.DropTable( + name: "Players_Auth"); + + migrationBuilder.DropTable( + name: "Roles"); + + migrationBuilder.DropTable( + name: "Alliances"); + + migrationBuilder.DropTable( + name: "Players"); + + migrationBuilder.DropTable( + name: "Kingdoms"); + } + } +} diff --git a/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/GameDbContextModelSnapshot.cs b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/GameDbContextModelSnapshot.cs new file mode 100644 index 0000000..52720d8 --- /dev/null +++ b/ShadowedRealmsMobile/src/server/ShadowedRealms.Data/Migrations/GameDbContextModelSnapshot.cs @@ -0,0 +1,1887 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using ShadowedRealms.Data.Contexts; + +#nullable disable + +namespace ShadowedRealms.Data.Migrations +{ + [DbContext(typeof(GameDbContext))] + partial class GameDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.10") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("Role_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Claims", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("integer"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Player_Logins", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("RoleId") + .HasColumnType("integer"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("Player_Roles", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("integer"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Player_Tokens", (string)null); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptsCoalitionInvites") + .HasColumnType("boolean"); + + b.Property("CoalitionReputationScore") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentCoalitionId") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("EconomicGatheringResearch") + .HasColumnType("integer"); + + b.Property("EconomicProductionResearch") + .HasColumnType("integer"); + + b.Property("EconomicStorageResearch") + .HasColumnType("integer"); + + b.Property("EconomicTaxationResearch") + .HasColumnType("integer"); + + b.Property("EconomicTradeResearch") + .HasColumnType("integer"); + + b.Property("ExperiencePoints") + .HasColumnType("bigint"); + + b.Property("FortressLevel") + .HasColumnType("integer"); + + b.Property("FortressX") + .HasColumnType("integer"); + + b.Property("FortressY") + .HasColumnType("integer"); + + b.Property("HasTerritory") + .HasColumnType("boolean"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsOpenToJoin") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKParticipations") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastKvKParticipation") + .HasColumnType("timestamp with time zone"); + + b.Property("LeaderId") + .HasColumnType("integer"); + + b.Property("Level") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("MaxMembers") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(50); + + b.Property("MilitaryAttackResearch") + .HasColumnType("integer"); + + b.Property("MilitaryCapacityResearch") + .HasColumnType("integer"); + + b.Property("MilitaryDefenseResearch") + .HasColumnType("integer"); + + b.Property("MilitaryHealthResearch") + .HasColumnType("integer"); + + b.Property("MilitarySpeedResearch") + .HasColumnType("integer"); + + b.Property("MinCastleLevelToJoin") + .HasColumnType("integer"); + + b.Property("MinPowerToJoin") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("RequireApproval") + .HasColumnType("boolean"); + + b.Property("ResourceBuildingCount") + .HasColumnType("integer"); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesShared") + .HasColumnType("bigint"); + + b.Property("Tag") + .IsRequired() + .HasMaxLength(5) + .HasColumnType("character varying(5)"); + + b.Property("TechnologyConstructionResearch") + .HasColumnType("integer"); + + b.Property("TechnologyHealingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyResearchResearch") + .HasColumnType("integer"); + + b.Property("TechnologyTrainingResearch") + .HasColumnType("integer"); + + b.Property("TechnologyUpgradeResearch") + .HasColumnType("integer"); + + b.Property("TotalDeaths") + .HasColumnType("bigint"); + + b.Property("TotalKills") + .HasColumnType("bigint"); + + b.Property("TowerCount") + .HasColumnType("integer"); + + b.Property("TreasuryFood") + .HasColumnType("bigint"); + + b.Property("TreasuryIron") + .HasColumnType("bigint"); + + b.Property("TreasuryMithril") + .HasColumnType("bigint"); + + b.Property("TreasurySilver") + .HasColumnType("bigint"); + + b.Property("TreasuryWood") + .HasColumnType("bigint"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_Alliances_KingdomId"); + + b.HasIndex("LeaderId") + .IsUnique(); + + b.HasIndex("Name") + .HasDatabaseName("IX_Alliances_Name"); + + b.HasIndex("Power") + .HasDatabaseName("IX_Alliances_Power"); + + b.HasIndex("Tag") + .HasDatabaseName("IX_Alliances_Tag"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Alliances_Kingdom_Power"); + + b.ToTable("Alliances"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ExpiresAt") + .HasColumnType("timestamp with time zone"); + + b.Property("InvitedById") + .HasColumnType("integer"); + + b.Property("IsAccepted") + .HasColumnType("boolean"); + + b.Property("IsRejected") + .HasColumnType("boolean"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_AllianceInvitation_AllianceId"); + + b.HasIndex("InvitedById") + .HasDatabaseName("IX_AllianceInvitation_InvitedById"); + + b.HasIndex("PlayerId") + .HasDatabaseName("IX_AllianceInvitation_PlayerId"); + + b.ToTable("AllianceInvitation"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AssignedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("AssignedById") + .HasColumnType("integer"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("Rank") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_AllianceRole_AllianceId"); + + b.HasIndex("AssignedById") + .HasDatabaseName("IX_AllianceRole_AssignedById"); + + b.HasIndex("PlayerId") + .HasDatabaseName("IX_AllianceRole_PlayerId"); + + b.ToTable("AllianceRole"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AttackerAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("AttackerAllianceId") + .HasColumnType("integer"); + + b.Property("AttackerAllianceId1") + .HasColumnType("integer"); + + b.Property("AttackerBowmenAfter") + .HasColumnType("bigint"); + + b.Property("AttackerBowmenBefore") + .HasColumnType("bigint"); + + b.Property("AttackerCasualties") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerCavalryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerDragonBonus") + .HasColumnType("double precision"); + + b.Property("AttackerDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("AttackerHadDragon") + .HasColumnType("boolean"); + + b.Property("AttackerHighestTroopTier") + .HasColumnType("integer"); + + b.Property("AttackerInfantryAfter") + .HasColumnType("bigint"); + + b.Property("AttackerInfantryBefore") + .HasColumnType("bigint"); + + b.Property("AttackerPlayerId") + .HasColumnType("integer"); + + b.Property("AttackerPlayerId1") + .HasColumnType("integer"); + + b.Property("AttackerPowerBefore") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeAfter") + .HasColumnType("bigint"); + + b.Property("AttackerSiegeBefore") + .HasColumnType("bigint"); + + b.Property("AttackerWoundedTroops") + .HasColumnType("bigint"); + + b.Property("BattleNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BattleX") + .HasColumnType("integer"); + + b.Property("BattleY") + .HasColumnType("integer"); + + b.Property("CoalitionId") + .HasColumnType("integer"); + + b.Property("CombatType") + .HasColumnType("integer"); + + b.Property("DefenderAllianceAttackBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceDefenseBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceHealthBonus") + .HasColumnType("double precision"); + + b.Property("DefenderAllianceId") + .HasColumnType("integer"); + + b.Property("DefenderAllianceId1") + .HasColumnType("integer"); + + b.Property("DefenderBowmenAfter") + .HasColumnType("bigint"); + + b.Property("DefenderBowmenBefore") + .HasColumnType("bigint"); + + b.Property("DefenderCasualties") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderCavalryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderDragonBonus") + .HasColumnType("double precision"); + + b.Property("DefenderDragonSkillsUsed") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("DefenderHadDragon") + .HasColumnType("boolean"); + + b.Property("DefenderHighestTroopTier") + .HasColumnType("integer"); + + b.Property("DefenderInfantryAfter") + .HasColumnType("bigint"); + + b.Property("DefenderInfantryBefore") + .HasColumnType("bigint"); + + b.Property("DefenderPlayerId") + .HasColumnType("integer"); + + b.Property("DefenderPlayerId1") + .HasColumnType("integer"); + + b.Property("DefenderPowerBefore") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeAfter") + .HasColumnType("bigint"); + + b.Property("DefenderSiegeBefore") + .HasColumnType("bigint"); + + b.Property("DefenderWoundedTroops") + .HasColumnType("bigint"); + + b.Property("DetailedBattleReport") + .HasMaxLength(4000) + .HasColumnType("character varying(4000)"); + + b.Property("FoodTransferred") + .HasColumnType("bigint"); + + b.Property("ForestSpeedReduction") + .HasColumnType("double precision"); + + b.Property("InterceptionType") + .HasColumnType("integer"); + + b.Property("InterceptorPlayerId") + .HasColumnType("integer"); + + b.Property("InterceptorPlayerId1") + .HasColumnType("integer"); + + b.Property("IronTransferred") + .HasColumnType("bigint"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("KvKEventId") + .HasColumnType("integer"); + + b.Property("MarchArrivalTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MarchDurationSeconds") + .HasColumnType("integer"); + + b.Property("MarchStartTime") + .HasColumnType("timestamp with time zone"); + + b.Property("MithrilTransferred") + .HasColumnType("bigint"); + + b.Property("Result") + .HasColumnType("integer"); + + b.Property("SilverTransferred") + .HasColumnType("bigint"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("UsedSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("WasFieldInterception") + .HasColumnType("boolean"); + + b.Property("WasInForestZone") + .HasColumnType("boolean"); + + b.Property("WasKvKBattle") + .HasColumnType("boolean"); + + b.Property("WoodTransferred") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AttackerAllianceId") + .HasDatabaseName("IX_CombatLogs_AttackerAllianceId"); + + b.HasIndex("AttackerAllianceId1"); + + b.HasIndex("AttackerPlayerId") + .HasDatabaseName("IX_CombatLogs_AttackerPlayerId"); + + b.HasIndex("AttackerPlayerId1"); + + b.HasIndex("DefenderAllianceId") + .HasDatabaseName("IX_CombatLogs_DefenderAllianceId"); + + b.HasIndex("DefenderAllianceId1"); + + b.HasIndex("DefenderPlayerId") + .HasDatabaseName("IX_CombatLogs_DefenderPlayerId"); + + b.HasIndex("DefenderPlayerId1"); + + b.HasIndex("InterceptorPlayerId") + .HasDatabaseName("IX_CombatLogs_InterceptorPlayerId"); + + b.HasIndex("InterceptorPlayerId1"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_CombatLogs_KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("Timestamp") + .HasDatabaseName("IX_CombatLogs_Timestamp"); + + b.HasIndex("KingdomId", "Timestamp") + .HasDatabaseName("IX_CombatLogs_Kingdom_Time"); + + b.ToTable("CombatLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptingNewPlayers") + .HasColumnType("boolean"); + + b.Property("AutoKickInactivePlayers") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("CurrentPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(0); + + b.Property("CurrentPowerRank") + .HasColumnType("integer"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("EnableTaxSystem") + .HasColumnType("boolean"); + + b.Property("InactivityKickDays") + .HasColumnType("integer"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("IsEligibleForKvK") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMerger") + .HasColumnType("boolean"); + + b.Property("IsInKvK") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KvKDraws") + .HasColumnType("integer"); + + b.Property("KvKHostAllianceId") + .HasColumnType("integer"); + + b.Property("KvKLosses") + .HasColumnType("integer"); + + b.Property("KvKWins") + .HasColumnType("integer"); + + b.Property("LastActivity") + .HasColumnType("timestamp with time zone"); + + b.Property("LastKvKDate") + .HasColumnType("timestamp with time zone"); + + b.Property("MaxPopulation") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1500); + + b.Property("MergerAvailableDate") + .HasColumnType("timestamp with time zone"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Number") + .HasColumnType("integer"); + + b.Property("TaxRate") + .HasColumnType("decimal(5,4)"); + + b.Property("TotalPower") + .HasColumnType("bigint"); + + b.Property("TotalTaxCollected") + .HasColumnType("decimal(18,2)"); + + b.Property("WelcomeMessage") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.HasKey("Id"); + + b.HasIndex("Name") + .HasDatabaseName("IX_Kingdoms_Name"); + + b.HasIndex("Number") + .IsUnique() + .HasDatabaseName("IX_Kingdoms_Number"); + + b.ToTable("Kingdoms"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcceptAllianceInvites") + .HasColumnType("boolean"); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AttacksLost") + .HasColumnType("bigint"); + + b.Property("AttacksWon") + .HasColumnType("bigint"); + + b.Property("AutoUseSpeedBoosts") + .HasColumnType("boolean"); + + b.Property("Biography") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("BowmenT1") + .HasColumnType("bigint"); + + b.Property("BowmenT10") + .HasColumnType("bigint"); + + b.Property("BowmenT11") + .HasColumnType("bigint"); + + b.Property("BowmenT12") + .HasColumnType("bigint"); + + b.Property("BowmenT13") + .HasColumnType("bigint"); + + b.Property("BowmenT2") + .HasColumnType("bigint"); + + b.Property("BowmenT3") + .HasColumnType("bigint"); + + b.Property("BowmenT4") + .HasColumnType("bigint"); + + b.Property("BowmenT5") + .HasColumnType("bigint"); + + b.Property("CastleLevel") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasDefaultValue(1); + + b.Property("CavalryT1") + .HasColumnType("bigint"); + + b.Property("CavalryT10") + .HasColumnType("bigint"); + + b.Property("CavalryT11") + .HasColumnType("bigint"); + + b.Property("CavalryT12") + .HasColumnType("bigint"); + + b.Property("CavalryT13") + .HasColumnType("bigint"); + + b.Property("CavalryT2") + .HasColumnType("bigint"); + + b.Property("CavalryT3") + .HasColumnType("bigint"); + + b.Property("CavalryT4") + .HasColumnType("bigint"); + + b.Property("CavalryT5") + .HasColumnType("bigint"); + + b.Property("CoordinateX") + .HasColumnType("integer"); + + b.Property("CoordinateY") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("DefensesLost") + .HasColumnType("bigint"); + + b.Property("DefensesWon") + .HasColumnType("bigint"); + + b.Property("DragonExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("EnablePushNotifications") + .HasColumnType("boolean"); + + b.Property("Food") + .HasColumnType("bigint"); + + b.Property("FoodProtected") + .HasColumnType("bigint"); + + b.Property("Gold") + .HasColumnType("integer"); + + b.Property("HasActiveDragon") + .HasColumnType("boolean"); + + b.Property("InfantryT1") + .HasColumnType("bigint"); + + b.Property("InfantryT10") + .HasColumnType("bigint"); + + b.Property("InfantryT11") + .HasColumnType("bigint"); + + b.Property("InfantryT12") + .HasColumnType("bigint"); + + b.Property("InfantryT13") + .HasColumnType("bigint"); + + b.Property("InfantryT2") + .HasColumnType("bigint"); + + b.Property("InfantryT3") + .HasColumnType("bigint"); + + b.Property("InfantryT4") + .HasColumnType("bigint"); + + b.Property("InfantryT5") + .HasColumnType("bigint"); + + b.Property("Iron") + .HasColumnType("bigint"); + + b.Property("IronProtected") + .HasColumnType("bigint"); + + b.Property("IsActive") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(true); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("LastActiveAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("Mithril") + .HasColumnType("bigint"); + + b.Property("MithrilProtected") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("Power") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasDefaultValue(0L); + + b.Property("ResourcesGathered") + .HasColumnType("bigint"); + + b.Property("ResourcesRaided") + .HasColumnType("bigint"); + + b.Property("ShowOnlineStatus") + .HasColumnType("boolean"); + + b.Property("SiegeT1") + .HasColumnType("bigint"); + + b.Property("SiegeT10") + .HasColumnType("bigint"); + + b.Property("SiegeT11") + .HasColumnType("bigint"); + + b.Property("SiegeT12") + .HasColumnType("bigint"); + + b.Property("SiegeT13") + .HasColumnType("bigint"); + + b.Property("SiegeT2") + .HasColumnType("bigint"); + + b.Property("SiegeT3") + .HasColumnType("bigint"); + + b.Property("SiegeT4") + .HasColumnType("bigint"); + + b.Property("SiegeT5") + .HasColumnType("bigint"); + + b.Property("Silver") + .HasColumnType("bigint"); + + b.Property("SilverProtected") + .HasColumnType("bigint"); + + b.Property("TroopsKilled") + .HasColumnType("bigint"); + + b.Property("TroopsLost") + .HasColumnType("bigint"); + + b.Property("VipExpiryDate") + .HasColumnType("timestamp with time zone"); + + b.Property("VipLevel") + .HasColumnType("integer"); + + b.Property("Wood") + .HasColumnType("bigint"); + + b.Property("WoodProtected") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_Players_AllianceId"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_Players_KingdomId"); + + b.HasIndex("Name") + .HasDatabaseName("IX_Players_Name"); + + b.HasIndex("Power") + .HasDatabaseName("IX_Players_Power"); + + b.HasIndex("KingdomId", "AllianceId") + .HasDatabaseName("IX_Players_Kingdom_Alliance"); + + b.HasIndex("KingdomId", "Power") + .HasDatabaseName("IX_Players_Kingdom_Power"); + + b.ToTable("Players"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AllianceId") + .HasColumnType("integer"); + + b.Property("AllianceId1") + .HasColumnType("integer"); + + b.Property("Amount") + .HasColumnType("decimal(18,2)"); + + b.Property("BoostHours") + .HasColumnType("integer"); + + b.Property("BoostPercentage") + .HasColumnType("integer"); + + b.Property("BundleContents") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("BundleDiscountPercentage") + .HasColumnType("double precision"); + + b.Property("CampaignId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ChargebackAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDate") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputeDeadline") + .HasColumnType("timestamp with time zone"); + + b.Property("ChargebackDisputed") + .HasColumnType("boolean"); + + b.Property("ChargebackFee") + .HasColumnType("decimal(18,2)"); + + b.Property("ChargebackPenalty") + .HasColumnType("decimal(18,2)"); + + b.Property("ChargebackReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("Currency") + .IsRequired() + .HasMaxLength(10) + .HasColumnType("character varying(10)"); + + b.Property("DaysSinceLastPurchase") + .HasColumnType("integer"); + + b.Property("DetailedPurchaseData") + .HasMaxLength(2000) + .HasColumnType("character varying(2000)"); + + b.Property("DeviceInfo") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("DisputeStatus") + .HasColumnType("integer"); + + b.Property("DragonDaysAdded") + .HasColumnType("integer"); + + b.Property("DragonSkillsUnlocked") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("DragonType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("FoodReceived") + .HasColumnType("bigint"); + + b.Property("FraudNotes") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("FraudReason") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("FraudScore") + .HasColumnType("integer"); + + b.Property("GoldBalanceAfter") + .HasColumnType("integer"); + + b.Property("GoldBalanceBefore") + .HasColumnType("integer"); + + b.Property("GoldPurchased") + .HasColumnType("integer"); + + b.Property("GoldSpent") + .HasColumnType("integer"); + + b.Property("HasSkillBasedAlternative") + .HasColumnType("boolean"); + + b.Property("IPAddress") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("IronReceived") + .HasColumnType("bigint"); + + b.Property("IsBundle") + .HasColumnType("boolean"); + + b.Property("IsChargedBack") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsConstructionBoost") + .HasColumnType("boolean"); + + b.Property("IsDragonPurchase") + .HasColumnType("boolean"); + + b.Property("IsEligibleForMonthlyReward") + .HasColumnType("boolean"); + + b.Property("IsEligibleForYearlyReward") + .HasColumnType("boolean"); + + b.Property("IsFirstMonthlyPurchase") + .HasColumnType("boolean"); + + b.Property("IsFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsFraudSuspected") + .HasColumnType("boolean"); + + b.Property("IsHighRiskTransaction") + .HasColumnType("boolean"); + + b.Property("IsNewDevicePurchase") + .HasColumnType("boolean"); + + b.Property("IsRefunded") + .HasColumnType("boolean"); + + b.Property("IsResearchBoost") + .HasColumnType("boolean"); + + b.Property("IsResourcePackage") + .HasColumnType("boolean"); + + b.Property("IsSpeedBoostPurchase") + .HasColumnType("boolean"); + + b.Property("IsStealthPurchase") + .HasColumnType("boolean"); + + b.Property("IsSuspicious") + .HasColumnType("boolean"); + + b.Property("IsTrainingBoost") + .HasColumnType("boolean"); + + b.Property("IsVelocityFlagged") + .HasColumnType("boolean"); + + b.Property("IsVipPurchase") + .HasColumnType("boolean"); + + b.Property("KingdomId") + .HasColumnType("integer"); + + b.Property("KingdomId1") + .HasColumnType("integer"); + + b.Property("LifetimePurchaseCount") + .HasColumnType("integer"); + + b.Property("LifetimeSpendingAfter") + .HasColumnType("decimal(18,2)"); + + b.Property("LifetimeSpendingBefore") + .HasColumnType("decimal(18,2)"); + + b.Property("MinutesFromRegistration") + .HasColumnType("integer"); + + b.Property("MithrilReceived") + .HasColumnType("bigint"); + + b.Property("MonthlyPurchaseCount") + .HasColumnType("integer"); + + b.Property("MonthlySpendingAfter") + .HasColumnType("decimal(18,2)"); + + b.Property("MonthlySpendingBefore") + .HasColumnType("decimal(18,2)"); + + b.Property("NetRevenue") + .HasColumnType("decimal(18,2)"); + + b.Property("Notes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("Platform") + .IsRequired() + .HasMaxLength(20) + .HasColumnType("character varying(20)"); + + b.Property("PlatformFee") + .HasColumnType("decimal(18,2)"); + + b.Property("PlatformReceiptData") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("PlatformTransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PlatformUserId") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PlayerId") + .HasColumnType("integer"); + + b.Property("PlayerId1") + .HasColumnType("integer"); + + b.Property("ProcessedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductId") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("ProductName") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("PromotionCode") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("PurchaseDate") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone") + .HasDefaultValueSql("CURRENT_TIMESTAMP"); + + b.Property("PurchaseNotes") + .HasMaxLength(1000) + .HasColumnType("character varying(1000)"); + + b.Property("PurchaseType") + .HasColumnType("integer"); + + b.Property("PurchasesInLast24Hours") + .HasColumnType("integer"); + + b.Property("RefundAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("RefundDate") + .HasColumnType("timestamp with time zone"); + + b.Property("RefundReason") + .HasMaxLength(500) + .HasColumnType("character varying(500)"); + + b.Property("RefundedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("RequiresManualReview") + .HasColumnType("boolean"); + + b.Property("SecretSpendingTierAfter") + .HasColumnType("integer"); + + b.Property("SecretSpendingTierBefore") + .HasColumnType("integer"); + + b.Property("SilverReceived") + .HasColumnType("bigint"); + + b.Property("SkillAlternativeDescription") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("SkillAlternativeUsed") + .HasColumnType("double precision"); + + b.Property("SpeedBoostHours") + .HasColumnType("integer"); + + b.Property("SpeedBoostLevel") + .HasColumnType("integer"); + + b.Property("SpeedBoostQuantity") + .HasColumnType("integer"); + + b.Property("SpendingInLast24Hours") + .HasColumnType("decimal(18,2)"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("StealthType") + .HasMaxLength(50) + .HasColumnType("character varying(50)"); + + b.Property("StealthUsesAdded") + .HasColumnType("integer"); + + b.Property("TaxAmount") + .HasColumnType("decimal(18,2)"); + + b.Property("TimeInvestmentHours") + .HasColumnType("decimal(8,2)"); + + b.Property("TransactionId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("TriggeredVipMilestone") + .HasColumnType("boolean"); + + b.Property("UnlockedNewSecretTier") + .HasColumnType("boolean"); + + b.Property("UserAgent") + .HasMaxLength(200) + .HasColumnType("character varying(200)"); + + b.Property("VipDaysAdded") + .HasColumnType("integer"); + + b.Property("VipLevelAfter") + .HasColumnType("integer"); + + b.Property("VipLevelBefore") + .HasColumnType("integer"); + + b.Property("VipMilestoneReached") + .HasMaxLength(100) + .HasColumnType("character varying(100)"); + + b.Property("VipPointsAfter") + .HasColumnType("integer"); + + b.Property("VipPointsBefore") + .HasColumnType("integer"); + + b.Property("VipPointsEarned") + .HasColumnType("integer"); + + b.Property("WasChargeback") + .HasColumnType("boolean"); + + b.Property("WasRefunded") + .HasColumnType("boolean"); + + b.Property("WoodReceived") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("AllianceId") + .HasDatabaseName("IX_PurchaseLogs_AllianceId"); + + b.HasIndex("AllianceId1"); + + b.HasIndex("KingdomId") + .HasDatabaseName("IX_PurchaseLogs_KingdomId"); + + b.HasIndex("KingdomId1"); + + b.HasIndex("PlayerId") + .HasDatabaseName("IX_PurchaseLogs_PlayerId"); + + b.HasIndex("PlayerId1"); + + b.HasIndex("PurchaseDate") + .HasDatabaseName("IX_PurchaseLogs_PurchaseDate"); + + b.HasIndex("TransactionId") + .HasDatabaseName("IX_PurchaseLogs_TransactionId"); + + b.HasIndex("KingdomId", "PurchaseDate") + .HasDatabaseName("IX_PurchaseLogs_Kingdom_Time"); + + b.ToTable("PurchaseLogs"); + }); + + modelBuilder.Entity("ShadowedRealms.Data.Contexts.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("LastLoginAt") + .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("PlayerId") + .HasColumnType("integer"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Players_Auth", (string)null); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("ShadowedRealms.Data.Contexts.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Alliances") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_Alliances_Kingdoms_KingdomId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Leader") + .WithOne() + .HasForeignKey("ShadowedRealms.Core.Models.Alliance.Alliance", "LeaderId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_Alliances_Players_LeaderId"); + + b.Navigation("Kingdom"); + + b.Navigation("Leader"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceInvitation", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("PendingInvitations") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceInvitation_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InvitedBy") + .WithMany() + .HasForeignKey("InvitedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceInvitation_Players_InvitedById"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceInvitation_Players_PlayerId"); + + b.Navigation("Alliance"); + + b.Navigation("InvitedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.AllianceRole", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Roles") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceRole_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AssignedBy") + .WithMany() + .HasForeignKey("AssignedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceRole_Players_AssignedById"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired() + .HasConstraintName("FK_AllianceRole_Players_PlayerId"); + + b.Navigation("Alliance"); + + b.Navigation("AssignedBy"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Combat.CombatLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", null) + .WithMany() + .HasForeignKey("AttackerAllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_CombatLogs_Alliances_AttackerAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "AttackerAlliance") + .WithMany() + .HasForeignKey("AttackerAllianceId1"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("AttackerPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_CombatLogs_Players_AttackerPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "AttackerPlayer") + .WithMany() + .HasForeignKey("AttackerPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", null) + .WithMany() + .HasForeignKey("DefenderAllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_CombatLogs_Alliances_DefenderAllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "DefenderAlliance") + .WithMany() + .HasForeignKey("DefenderAllianceId1"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("DefenderPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_CombatLogs_Players_DefenderPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "DefenderPlayer") + .WithMany() + .HasForeignKey("DefenderPlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("InterceptorPlayerId") + .OnDelete(DeleteBehavior.Restrict) + .HasConstraintName("FK_CombatLogs_Players_InterceptorPlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "InterceptorPlayer") + .WithMany() + .HasForeignKey("InterceptorPlayerId1"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_CombatLogs_Kingdoms_KingdomId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AttackerAlliance"); + + b.Navigation("AttackerPlayer"); + + b.Navigation("DefenderAlliance"); + + b.Navigation("DefenderPlayer"); + + b.Navigation("InterceptorPlayer"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Player.Player", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany("Members") + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_Players_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany("Players") + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_Players_Kingdoms_KingdomId"); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Purchase.PurchaseLog", b => + { + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", null) + .WithMany() + .HasForeignKey("AllianceId") + .OnDelete(DeleteBehavior.SetNull) + .HasConstraintName("FK_PurchaseLogs_Alliances_AllianceId"); + + b.HasOne("ShadowedRealms.Core.Models.Alliance.Alliance", "Alliance") + .WithMany() + .HasForeignKey("AllianceId1"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", null) + .WithMany() + .HasForeignKey("KingdomId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_PurchaseLogs_Kingdoms_KingdomId"); + + b.HasOne("ShadowedRealms.Core.Models.Kingdom.Kingdom", "Kingdom") + .WithMany() + .HasForeignKey("KingdomId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", null) + .WithMany() + .HasForeignKey("PlayerId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired() + .HasConstraintName("FK_PurchaseLogs_Players_PlayerId"); + + b.HasOne("ShadowedRealms.Core.Models.Player.Player", "Player") + .WithMany() + .HasForeignKey("PlayerId1") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Alliance"); + + b.Navigation("Kingdom"); + + b.Navigation("Player"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Alliance.Alliance", b => + { + b.Navigation("Members"); + + b.Navigation("PendingInvitations"); + + b.Navigation("Roles"); + }); + + modelBuilder.Entity("ShadowedRealms.Core.Models.Kingdom.Kingdom", b => + { + b.Navigation("Alliances"); + + b.Navigation("Players"); + }); +#pragma warning restore 612, 618 + } + } +}