fix #2551 Error
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m22s
All checks were successful
Build & Deploy Leave Service / build (push) Successful in 2m22s
This commit is contained in:
parent
2cdae3578e
commit
6843e3ff3f
4 changed files with 14 additions and 1875 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,28 +0,0 @@
|
|||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddUniqueIndexLeaveBeginningProfileIdYearTypeId : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_LeaveBeginnings_ProfileId_LeaveYear_LeaveTypeId",
|
||||
table: "LeaveBeginnings",
|
||||
columns: new[] { "ProfileId", "LeaveYear", "LeaveTypeId" },
|
||||
unique: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_LeaveBeginnings_ProfileId_LeaveYear_LeaveTypeId",
|
||||
table: "LeaveBeginnings");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -50,7 +50,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Document");
|
||||
b.ToTable("Document", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Commons.LeaveType", b =>
|
||||
|
|
@ -116,7 +116,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LeaveTypes");
|
||||
b.ToTable("LeaveTypes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveBeginning", b =>
|
||||
|
|
@ -226,11 +226,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasIndex("LeaveTypeId");
|
||||
|
||||
b.HasIndex("ProfileId", "LeaveYear", "LeaveTypeId")
|
||||
.IsUnique()
|
||||
.HasDatabaseName("IX_LeaveBeginnings_ProfileId_LeaveYear_LeaveTypeId");
|
||||
|
||||
b.ToTable("LeaveBeginnings");
|
||||
b.ToTable("LeaveBeginnings", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveDocument", b =>
|
||||
|
|
@ -292,7 +288,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasIndex("LeaveRequestId");
|
||||
|
||||
b.ToTable("LeaveDocuments");
|
||||
b.ToTable("LeaveDocuments", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequest", b =>
|
||||
|
|
@ -671,7 +667,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasIndex("TypeId");
|
||||
|
||||
b.ToTable("LeaveRequests");
|
||||
b.ToTable("LeaveRequests", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveRequestApprover", b =>
|
||||
|
|
@ -790,7 +786,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasIndex("LeaveRequestId");
|
||||
|
||||
b.ToTable("LeaveRequestApprovers");
|
||||
b.ToTable("LeaveRequestApprovers", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.AdditionalCheckRequest", b =>
|
||||
|
|
@ -905,7 +901,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("AdditionalCheckRequests");
|
||||
b.ToTable("AdditionalCheckRequests", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.CheckInJobStatus", b =>
|
||||
|
|
@ -998,7 +994,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("CheckInJobStatuses");
|
||||
b.ToTable("CheckInJobStatuses", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.DutyTime", b =>
|
||||
|
|
@ -1083,7 +1079,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("DutyTimes");
|
||||
b.ToTable("DutyTimes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.LeaveProcessJobStatus", b =>
|
||||
|
|
@ -1168,7 +1164,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("LeaveProcessJobStatuses");
|
||||
b.ToTable("LeaveProcessJobStatuses", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.ProcessUserTimeStamp", b =>
|
||||
|
|
@ -1379,7 +1375,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ProcessUserTimeStamps");
|
||||
b.ToTable("ProcessUserTimeStamps", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserCalendar", b =>
|
||||
|
|
@ -1440,7 +1436,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserCalendars");
|
||||
b.ToTable("UserCalendars", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserDutyTime", b =>
|
||||
|
|
@ -1529,7 +1525,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasIndex("DutyTimeId");
|
||||
|
||||
b.ToTable("UserDutyTimes");
|
||||
b.ToTable("UserDutyTimes", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.TimeAttendants.UserTimeStamp", b =>
|
||||
|
|
@ -1723,7 +1719,7 @@ namespace BMA.EHR.Infrastructure.Migrations.LeaveDb
|
|||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("UserTimeStamps");
|
||||
b.ToTable("UserTimeStamps", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("BMA.EHR.Domain.Models.Leave.Requests.LeaveBeginning", b =>
|
||||
|
|
|
|||
|
|
@ -61,18 +61,5 @@ 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