diff --git a/src/Managing.Infrastructure.Database/PostgreSql/ManagingDbContext.cs b/src/Managing.Infrastructure.Database/PostgreSql/ManagingDbContext.cs index b16ed91..99c51e3 100644 --- a/src/Managing.Infrastructure.Database/PostgreSql/ManagingDbContext.cs +++ b/src/Managing.Infrastructure.Database/PostgreSql/ManagingDbContext.cs @@ -67,7 +67,6 @@ public class ManagingDbContext : DbContext // Create unique index on account name entity.HasIndex(e => e.Name).IsUnique(); - entity.HasIndex(e => e.Key); // Configure relationship with User entity.HasOne(e => e.User) @@ -117,7 +116,6 @@ public class ManagingDbContext : DbContext // Create indexes entity.HasIndex(e => e.RequestId).IsUnique(); entity.HasIndex(e => e.Status); - entity.HasIndex(e => e.CreatedAt); // Configure relationship with User entity.HasOne(e => e.User) @@ -150,11 +148,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.RequestId); entity.HasIndex(e => e.UserName); entity.HasIndex(e => e.Score); - entity.HasIndex(e => e.FinalPnl); - entity.HasIndex(e => e.WinRate); - entity.HasIndex(e => e.StartDate); - entity.HasIndex(e => e.EndDate); - entity.HasIndex(e => e.CreatedAt); // Composite indexes for efficient pagination and filtering entity.HasIndex(e => new { e.UserName, e.Score }); @@ -187,9 +180,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.RequestId).IsUnique(); entity.HasIndex(e => e.UserName); entity.HasIndex(e => e.Status); - entity.HasIndex(e => e.CreatedAt); - entity.HasIndex(e => e.CompletedAt); - entity.HasIndex(e => e.UserId); // Composite index for user queries ordered by creation date entity.HasIndex(e => new { e.UserName, e.CreatedAt }); @@ -203,9 +193,7 @@ public class ManagingDbContext : DbContext entity.Property(e => e.UserName).HasMaxLength(255); // Create indexes - entity.HasIndex(e => e.Name); entity.HasIndex(e => e.UserName); - entity.HasIndex(e => e.CreatedAt); // Composite index for user scenarios entity.HasIndex(e => new { e.UserName, e.Name }); @@ -222,10 +210,7 @@ public class ManagingDbContext : DbContext entity.Property(e => e.UserName).HasMaxLength(255); // Create indexes - entity.HasIndex(e => e.Name); - entity.HasIndex(e => e.Type); entity.HasIndex(e => e.UserName); - entity.HasIndex(e => e.CreatedAt); // Composite index for user indicators entity.HasIndex(e => new { e.UserName, e.Name }); @@ -248,8 +233,6 @@ public class ManagingDbContext : DbContext .OnDelete(DeleteBehavior.Cascade); // Create indexes - entity.HasIndex(e => e.ScenarioId); - entity.HasIndex(e => e.IndicatorId); entity.HasIndex(e => new { e.ScenarioId, e.IndicatorId }).IsUnique(); }); @@ -275,7 +258,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.Date); entity.HasIndex(e => e.Ticker); entity.HasIndex(e => e.Status); - entity.HasIndex(e => e.CreatedAt); // Composite indexes for common queries entity.HasIndex(e => new { e.UserName, e.Date }); @@ -321,9 +303,7 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.Identifier).IsUnique(); entity.HasIndex(e => e.UserName); entity.HasIndex(e => e.Status); - entity.HasIndex(e => e.Initiator); entity.HasIndex(e => e.Date); - entity.HasIndex(e => e.CreatedAt); // Composite indexes entity.HasIndex(e => new { e.UserName, e.Identifier }); @@ -348,7 +328,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.Date); entity.HasIndex(e => e.Status); entity.HasIndex(e => e.ExchangeOrderId); - entity.HasIndex(e => e.CreatedAt); }); @@ -362,7 +341,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.Ticker); entity.HasIndex(e => e.Date); entity.HasIndex(e => e.Exchange); - entity.HasIndex(e => e.Rank); // Composite indexes for efficient queries entity.HasIndex(e => new { e.Exchange, e.Date }); @@ -379,7 +357,6 @@ public class ManagingDbContext : DbContext // Create indexes entity.HasIndex(e => e.Identifier).IsUnique(); entity.HasIndex(e => e.DateTime); - entity.HasIndex(e => e.ScenarioCount); // Composite index for efficient queries entity.HasIndex(e => new { e.DateTime, e.ScenarioCount }); @@ -419,7 +396,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.Ticker); entity.HasIndex(e => e.Exchange); entity.HasIndex(e => e.Date); - entity.HasIndex(e => e.Direction); // Composite indexes for efficient queries entity.HasIndex(e => new { e.Ticker, e.Exchange }); @@ -446,7 +422,6 @@ public class ManagingDbContext : DbContext // Create indexes entity.HasIndex(e => e.Identifier).IsUnique(); entity.HasIndex(e => e.Status); - entity.HasIndex(e => e.CreateDate); // Configure relationship with User entity.HasOne(e => e.User) @@ -467,7 +442,6 @@ public class ManagingDbContext : DbContext entity.Property(e => e.UserName).HasMaxLength(255); // Create indexes - entity.HasIndex(e => e.Name); entity.HasIndex(e => e.UserName); // Composite index for user money managements @@ -505,7 +479,6 @@ public class ManagingDbContext : DbContext entity.Property(e => e.CacheKey).IsRequired().HasMaxLength(255); entity.Property(e => e.CreatedAt).IsRequired(); entity.HasIndex(e => e.CacheKey).IsUnique(); - entity.HasIndex(e => e.CreatedAt); }); // Configure SynthPrediction entity @@ -522,7 +495,6 @@ public class ManagingDbContext : DbContext entity.Property(e => e.CacheKey).IsRequired().HasMaxLength(255); entity.Property(e => e.CreatedAt).IsRequired(); entity.HasIndex(e => e.CacheKey).IsUnique(); - entity.HasIndex(e => e.CreatedAt); }); // Configure AgentSummary entity @@ -545,7 +517,6 @@ public class ManagingDbContext : DbContext entity.HasIndex(e => e.UserId).IsUnique(); entity.HasIndex(e => e.AgentName); entity.HasIndex(e => e.TotalPnL); - entity.HasIndex(e => e.UpdatedAt); // Configure relationship with User entity.HasOne(e => e.User)