Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
GrantManagerConsts.DbSchema);
b.ConfigureByConvention();
b.HasIndex(x => x.OidcSub);
b.HasIndex(x => x.TenantId);
});

modelBuilder.Entity<Applicant>(b =>
Expand All @@ -80,6 +81,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasMaxLength(600);

b.HasIndex(x => x.ApplicantName);
b.HasIndex(x => x.TenantId);

b.HasMany<ApplicantAddress>()
.WithOne(s => s.Applicant)
Expand Down Expand Up @@ -111,6 +113,8 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasForeignKey(x => x.ParentFormId)
.IsRequired(false)
.OnDelete(DeleteBehavior.NoAction);

b.HasIndex(x => new { x.TenantId, x.IsDeleted }).HasFilter("\"IsDeleted\" = false");
});

modelBuilder.Entity<ApplicationFormVersion>(b =>
Expand Down Expand Up @@ -156,6 +160,9 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.WithMany(s => s.Applications)
.HasForeignKey(x => x.ApplicationStatusId)
.IsRequired();

b.HasIndex(x => new { x.TenantId, x.SubmissionDate }).HasFilter("\"IsDeleted\" = false");
b.HasIndex(x => x.ReferenceNo);
});

modelBuilder.Entity<ApplicantAddress>(b =>
Expand All @@ -181,6 +188,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)

b.ConfigureByConvention(); //auto configure for the base class props
b.HasOne<Applicant>().WithMany().HasForeignKey(x => x.ApplicantId).IsRequired();
b.HasIndex(x => new { x.TenantId, x.ApplicationId });
});

modelBuilder.Entity<ApplicantComment>(b =>
Expand Down Expand Up @@ -286,6 +294,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
GrantManagerConsts.DbSchema);

b.ConfigureByConvention();
b.HasIndex(x => new { x.TenantId, x.ApplicationId });
});

modelBuilder.Entity<ApplicationTags>(b =>
Expand All @@ -298,8 +307,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.HasForeignKey(x => x.TagId)
.IsRequired()
.OnDelete(DeleteBehavior.NoAction);


b.HasIndex(x => new { x.TenantId, x.ApplicationId });
});

modelBuilder.Entity<ApplicationContact>(b =>
Expand Down Expand Up @@ -327,7 +335,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
.IsRequired()
.HasDefaultValue(ApplicationLinkType.Related)
.HasConversion(new EnumToStringConverter<ApplicationLinkType>());

b.HasIndex(x => new { x.TenantId, x.ApplicationId });
});

modelBuilder.Entity<Tag>(b =>
Expand Down
Loading
Loading