issue #2551
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m58s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m58s
This commit is contained in:
parent
71966eb4e9
commit
2cdae3578e
7 changed files with 1996 additions and 40 deletions
|
|
@ -61,5 +61,18 @@ namespace BMA.EHR.Infrastructure.Persistence
|
|||
{
|
||||
base.Entry(entity).State = EntityState.Detached;
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
// Composite unique index on the natural key for LeaveBeginning.
|
||||
// Prevents duplicate rows when concurrent requests (e.g. UI calling /user/check twice)
|
||||
// race through the get-or-create flow in LeaveBeginningRepository.
|
||||
modelBuilder.Entity<LeaveBeginning>()
|
||||
.HasIndex(b => new { b.ProfileId, b.LeaveYear, b.LeaveTypeId })
|
||||
.HasDatabaseName("IX_LeaveBeginnings_ProfileId_LeaveYear_LeaveTypeId")
|
||||
.IsUnique();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue