perf(db): add remaining hot-path indexes (status filter, correspondence/event FKs)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -71,6 +71,11 @@ namespace JobTrackerApi.Data
|
||||
modelBuilder.Entity<JobApplication>()
|
||||
.HasIndex(j => new { j.OwnerUserId, j.FollowUpAt });
|
||||
|
||||
// Board/list endpoints that filter by both IsDeleted and Status. Same MySQL
|
||||
// longtext-prefix caveat as above; the reconciler applies `Status(50)` there.
|
||||
modelBuilder.Entity<JobApplication>()
|
||||
.HasIndex(j => new { j.OwnerUserId, j.IsDeleted, j.Status });
|
||||
|
||||
modelBuilder.Entity<Company>()
|
||||
.HasIndex(c => c.OwnerUserId);
|
||||
|
||||
@@ -81,6 +86,9 @@ namespace JobTrackerApi.Data
|
||||
.HasForeignKey(c => c.JobApplicationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<Correspondence>()
|
||||
.HasIndex(c => c.JobApplicationId);
|
||||
|
||||
modelBuilder.Entity<GmailConnection>()
|
||||
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
|
||||
|
||||
@@ -111,6 +119,9 @@ namespace JobTrackerApi.Data
|
||||
.HasForeignKey(e => e.JobApplicationId)
|
||||
.OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
modelBuilder.Entity<JobEvent>()
|
||||
.HasIndex(e => e.JobApplicationId);
|
||||
|
||||
modelBuilder.Entity<CvUploadArtifact>()
|
||||
.HasQueryFilter(x => CurrentUserId != null && x.OwnerUserId == CurrentUserId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user