From 9f2269d737203a4445e10a6e94390c8b5fe0b9b6 Mon Sep 17 00:00:00 2001 From: terjebra Date: Thu, 21 Dec 2023 15:13:30 +0100 Subject: [PATCH 1/2] Removed contract related entites --- .../Entities/DbContract.cs | 20 - .../Entities/DbContractPersonnel.cs | 43 - .../DbContractPersonnelReplacement.cs | 45 - .../Entities/DbContractorRequest.cs | 99 -- .../Entities/DbDelegatedRole.cs | 47 - .../Entities/DbExternalPersonnelPerson.cs | 66 - .../Entities/DbProject.cs | 2 - ...41201_Remove Contract entities.Designer.cs | 1257 +++++++++++++++++ ...20231221141201_Remove Contract entities.cs | 409 ++++++ .../ResourcesDbContextModelSnapshot.cs | 601 +------- .../ResourcesDbContext.cs | 18 - 11 files changed, 1670 insertions(+), 937 deletions(-) delete mode 100644 src/backend/api/Fusion.Resources.Database/Entities/DbContract.cs delete mode 100644 src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnel.cs delete mode 100644 src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnelReplacement.cs delete mode 100644 src/backend/api/Fusion.Resources.Database/Entities/DbContractorRequest.cs delete mode 100644 src/backend/api/Fusion.Resources.Database/Entities/DbDelegatedRole.cs delete mode 100644 src/backend/api/Fusion.Resources.Database/Entities/DbExternalPersonnelPerson.cs create mode 100644 src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs create mode 100644 src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbContract.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbContract.cs deleted file mode 100644 index 7bccc2cc4..000000000 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbContract.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; - -namespace Fusion.Resources.Database.Entities -{ - public class DbContract - { - public Guid Id { get; set; } - public string ContractNumber { get; set; } = null!; - public Guid OrgContractId { get; set; } - public string Name { get; set; } = null!; - - public DbProject Project { get; set; } = null!; - public Guid ProjectId { get; set; } - - public DateTimeOffset Allocated { get; set; } - public DbPerson AllocatedBy { get; set; } = null!; - public Guid AllocatedById { get; set; } - } - -} \ No newline at end of file diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnel.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnel.cs deleted file mode 100644 index e375092da..000000000 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnel.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; - -namespace Fusion.Resources.Database.Entities -{ - - public class DbContractPersonnel : ITrackableEntity - { - public Guid Id { get; set; } - - public DbContract Contract { get; set; } = null!; - public Guid ContractId { get; set; } - - public DbProject Project { get; set; } = null!; - public Guid ProjectId { get; set; } - - public DbExternalPersonnelPerson Person { get; set; } = null!; - public Guid PersonId { get; set; } - - public DateTimeOffset Created { get; set; } - public DateTimeOffset? Updated { get; set; } - public DbPerson CreatedBy { get; set; } = null!; - public DbPerson? UpdatedBy { get; set; } - - public Guid CreatedById { get; set; } - public Guid? UpdatedById { get; set; } - - - internal static void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.HasOne(e => e.Contract).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.Project).WithMany().OnDelete(DeleteBehavior.Restrict); - - entity.HasOne(e => e.CreatedBy).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.UpdatedBy).WithMany().OnDelete(DeleteBehavior.Restrict); - }); - - } - } - -} diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnelReplacement.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnelReplacement.cs deleted file mode 100644 index 8c63cc78b..000000000 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbContractPersonnelReplacement.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; - -namespace Fusion.Resources.Database.Entities -{ - public class DbContractPersonnelReplacement - { - public Guid Id { get; set; } - - public Guid ProjectId { get; set; } - public Guid ContractId { get; set; } - public string Message { get; set; } = null!; - - [MaxLength(50)] - public string? ChangeType { get; set; } - [MaxLength(200)] - public string? UPN { get; set; } - [MaxLength(200)] - public string? FromPerson { get; set; } - [MaxLength(200)] - public string? ToPerson { get; set; } - - public DateTimeOffset Created { get; set; } - [MaxLength(200)] - public string? CreatedBy { get; set; } - - public static void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(x => - { - x.HasIndex(e => new { e.ProjectId, e.ContractId }).IsClustered(false) - .IncludeProperties(e => new - { - e.UPN, - e.FromPerson, - e.ToPerson, - e.ChangeType, - ReplacedTimestamp = e.Created, - ReplacedBy = e.CreatedBy - }); - }); - } - } -} \ No newline at end of file diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbContractorRequest.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbContractorRequest.cs deleted file mode 100644 index 020d62898..000000000 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbContractorRequest.cs +++ /dev/null @@ -1,99 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; - -namespace Fusion.Resources.Database.Entities -{ - public class DbContractorRequest - { - public Guid Id { get; set; } - public string? Description { get; set; } - - - public DbContract Contract { get; set; } = null!; - public Guid ContractId { get; set; } - - public DbProject Project { get; set; } = null!; - public Guid ProjectId { get; set; } - - public DbContractPersonnel Person { get; set; } = null!; - public Guid PersonId { get; set; } - - public RequestPosition Position { get; set; } = new RequestPosition(); - - public DbRequestState State { get; set; } - public DbRequestCategory Category { get; set; } - - public Guid? OriginalPositionId { get; set; } - - public ProvisionStatus ProvisioningStatus { get; set; } = new ProvisionStatus(); - - public DateTimeOffset Created { get; set; } - public DateTimeOffset? Updated { get; set; } - public DbPerson CreatedBy { get; set; } = null!; - public DbPerson? UpdatedBy { get; set; } - - public Guid CreatedById { get; set; } - public Guid? UpdatedById { get; set; } - - public DateTimeOffset LastActivity { get; set; } - - internal static void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.HasOne(e => e.Contract).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.Project).WithMany().OnDelete(DeleteBehavior.Restrict); - - entity.HasOne(e => e.CreatedBy).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.UpdatedBy).WithMany().OnDelete(DeleteBehavior.Restrict); - - - entity.OwnsOne(e => e.ProvisioningStatus, op => - { - op.Property(ps => ps.State).HasConversion(new EnumToStringConverter()); - }); - entity.OwnsOne(e => e.Position, op => - { - op.OwnsOne(p => p.TaskOwner); - }); - - entity.Property(e => e.State).HasConversion(new EnumToStringConverter()); - entity.Property(e => e.Category).HasConversion(new EnumToStringConverter()); - entity.Property(e => e.LastActivity).HasDefaultValue(DateTimeOffset.MinValue); - entity.HasIndex(e => e.LastActivity).IsClustered(false); - }); - } - - public class RequestPosition - { - public string Name { get; set; } = null!; - public Guid BasePositionId { get; set; } - public DateTime AppliesFrom { get; set; } - public DateTime AppliesTo { get; set; } - public string? Obs { get; set; } - public double Workload { get; set; } - - public PositionTaskOwner TaskOwner { get; set; } = new PositionTaskOwner(); - } - - public class PositionTaskOwner - { - public Guid? PositionId { get; set; } - public Guid? RequestId { get; set; } - } - - public class ProvisionStatus - { - public DbProvisionState State { get; set; } = DbProvisionState.NotProvisioned; - public Guid? PositionId { get; set; } - public DateTimeOffset? Provisioned { get; set; } - public string? ErrorMessage { get; set; } - public string? ErrorPayload { get; set; } - } - - public enum DbProvisionState { NotProvisioned, Provisioned, Error } - } - - -} diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbDelegatedRole.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbDelegatedRole.cs deleted file mode 100644 index 4a3e3d6d6..000000000 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbDelegatedRole.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using System; - -namespace Fusion.Resources.Database.Entities -{ - public class DbDelegatedRole - { - public Guid Id { get; set; } - - public Guid PersonId { get; set; } - public DbPerson Person { get; set; } = null!; - - public DbDelegatedRoleType Type { get; set; } - public DbDelegatedRoleClassification Classification { get; set; } - - public DateTimeOffset Created { get; set; } - public DateTimeOffset ValidTo { get; set; } - public DateTimeOffset? RecertifiedDate { get; set; } - - public Guid CreatedById { get; set; } - public DbPerson CreatedBy { get; set; } = null!; - - public Guid? RecertifiedById { get; set; } - public DbPerson? RecertifiedBy { get; set; } = null!; - - public DbContract Contract { get; set; } = null!; - public Guid ContractId { get; set; } - - public DbProject Project { get; set; } = null!; - public Guid ProjectId { get; set; } - - internal static void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.HasOne(e => e.Contract).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.Project).WithMany().OnDelete(DeleteBehavior.Restrict); - - entity.HasOne(e => e.Person).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.CreatedBy).WithMany().OnDelete(DeleteBehavior.Restrict); - entity.HasOne(e => e.RecertifiedBy).WithMany().OnDelete(DeleteBehavior.Restrict); - }); - - } - } - -} \ No newline at end of file diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbExternalPersonnelPerson.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbExternalPersonnelPerson.cs deleted file mode 100644 index 5f778c875..000000000 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbExternalPersonnelPerson.cs +++ /dev/null @@ -1,66 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Fusion.Resources.Database.Entities -{ - - public class DbExternalPersonnelPerson - { - public Guid Id { get; set; } - - public Guid? AzureUniqueId { get; set; } - - [MaxLength(200)] - public string? UPN { get; set; } - - public DbAzureAccountStatus AccountStatus { get; set; } - - [MaxLength(100)] - public string Name { get; set; } = null!; - [MaxLength(50)] - public string FirstName { get; set; } = null!; - [MaxLength(50)] - public string LastName { get; set; } = null!; - - [MaxLength(100)] - public string Mail { get; set; } = null!; - [MaxLength(30)] - public string Phone { get; set; } = null!; - [MaxLength(100)] - public string? JobTitle { get; set; } - - [MaxLength(100)] - public string? PreferredContractMail { get; set; } - - [MaxLength(20)] - public string? DawinciCode { get; set; } - [MaxLength(100)] - public string? LinkedInProfile { get; set; } - - public bool? IsDeleted { get; set; } - public DateTimeOffset? Deleted { get; set; } - public ICollection Disciplines { get; set; } = null!; - - /// - /// This property is used for historic person identifiers. - /// Persons may be replaced multiple times, and can contain multiple personIds separated by comma - /// - public string? PersonIdReplacements { get; set; } - - internal static void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.Property(e => e.AccountStatus).HasConversion(new EnumToStringConverter()); - - entity.HasMany(e => e.Disciplines).WithOne().OnDelete(DeleteBehavior.Cascade); - entity.HasIndex(e => e.Mail).IsClustered(false); - }); - - } - } - -} diff --git a/src/backend/api/Fusion.Resources.Database/Entities/DbProject.cs b/src/backend/api/Fusion.Resources.Database/Entities/DbProject.cs index 9f6c6a99e..28d96d073 100644 --- a/src/backend/api/Fusion.Resources.Database/Entities/DbProject.cs +++ b/src/backend/api/Fusion.Resources.Database/Entities/DbProject.cs @@ -9,8 +9,6 @@ public class DbProject public string Name { get; set; } = null!; public string? DomainId { get; set; } public Guid OrgProjectId { get; set; } - - public ICollection Contracts { get; set; } = null!; } diff --git a/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs b/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs new file mode 100644 index 000000000..5000491f4 --- /dev/null +++ b/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs @@ -0,0 +1,1257 @@ +// +using System; +using Fusion.Resources.Database; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace Fusion.Resources.Database.Migrations +{ + [DbContext(typeof(ResourcesDbContext))] + [Migration("20231221141201_Remove Contract entities")] + partial class RemoveContractentities + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "7.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("DbPersonDbResourceAllocationRequest", b => + { + b.Property("CandidatesForRequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("CandidatesId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("CandidatesForRequestId", "CandidatesId"); + + b.HasIndex("CandidatesId"); + + b.ToTable("DbPersonDbResourceAllocationRequest"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbConversationMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Body") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("Category") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("PropertiesJson") + .HasColumnType("nvarchar(max)"); + + b.Property("Recpient") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("SenderId") + .HasColumnType("uniqueidentifier"); + + b.Property("Sent") + .HasColumnType("datetimeoffset"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("RequestId"); + + b.HasIndex("SenderId"); + + b.ToTable("RequestConversations"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbDelegatedDepartmentResponsible", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreated") + .ValueGeneratedOnAdd() + .HasColumnType("datetimeoffset") + .HasDefaultValueSql("getutcdate()"); + + b.Property("DateFrom") + .HasColumnType("datetimeoffset"); + + b.Property("DateTo") + .HasColumnType("datetimeoffset"); + + b.Property("DateUpdated") + .ValueGeneratedOnAdd() + .HasColumnType("datetimeoffset") + .HasDefaultValueSql("getutcdate()"); + + b.Property("DepartmentId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponsibleAzureObjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdatedBy") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("DelegatedDepartmentResponsibles"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbDelegatedDepartmentResponsibleHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Archived") + .HasColumnType("datetimeoffset"); + + b.Property("DateCreated") + .HasColumnType("datetimeoffset"); + + b.Property("DateFrom") + .HasColumnType("datetimeoffset"); + + b.Property("DateTo") + .HasColumnType("datetimeoffset"); + + b.Property("DateUpdated") + .HasColumnType("datetimeoffset"); + + b.Property("DepartmentId") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("ResponsibleAzureObjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdatedBy") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("DelegatedDepartmentResponsiblesHistory"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPerson", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccountType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("AzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b.Property("JobTitle") + .HasColumnType("nvarchar(max)"); + + b.Property("Mail") + .HasColumnType("nvarchar(450)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("AzureUniqueId") + .IsUnique(); + + b.HasIndex("Mail"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("Mail"), false); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonAbsence", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AbsencePercentage") + .HasColumnType("float"); + + b.Property("AppliesFrom") + .HasColumnType("datetimeoffset"); + + b.Property("AppliesTo") + .HasColumnType("datetimeoffset"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("IsPrivate") + .HasColumnType("bit"); + + b.Property("PersonId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("PersonId"); + + b.ToTable("PersonAbsences"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b.Property("Content") + .HasMaxLength(2500) + .HasColumnType("nvarchar(2500)"); + + b.Property("IsShared") + .HasColumnType("bit"); + + b.Property("Title") + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.Property("Updated") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AzureUniqueId"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("AzureUniqueId"), false); + SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("AzureUniqueId"), new[] { "Id", "Title", "Content", "IsShared", "Updated", "UpdatedById" }); + + b.HasIndex("UpdatedById"); + + b.ToTable("PersonNotes"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbProject", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("DomainId") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OrgProjectId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("Projects"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AssignedToId") + .HasColumnType("uniqueidentifier"); + + b.Property("Body") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("DueDate") + .HasColumnType("datetime2"); + + b.Property("IsRequired") + .IsRequired() + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValueSql("(0)"); + + b.Property("IsResolved") + .HasColumnType("bit"); + + b.Property("PropertiesJson") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("ResolvedAt") + .HasColumnType("datetimeoffset"); + + b.Property("ResolvedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Responsible") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SentById") + .HasColumnType("uniqueidentifier"); + + b.Property("Source") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SubType") + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedToId"); + + b.HasIndex("RequestId"); + + b.HasIndex("ResolvedById"); + + b.HasIndex("SentById"); + + b.ToTable("RequestActions", (string)null); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestComment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Created") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Origin") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("Updated") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("RequestId"); + + SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("RequestId"), false); + + b.HasIndex("UpdatedById"); + + b.ToTable("RequestComments"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AdditionalNote") + .HasColumnType("nvarchar(max)"); + + b.Property("AssignedDepartment") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CorrelationId") + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Discipline") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("IsDraft") + .HasColumnType("bit"); + + b.Property("LastActivity") + .HasColumnType("datetimeoffset"); + + b.Property("OrgPositionId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("ProposedChanges") + .HasColumnType("nvarchar(max)"); + + b.Property("RequestNumber") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RequestNumber")); + + b.Property("RequestOwner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SubType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ProjectId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("ResourceAllocationRequests"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResponsibilityMatrix", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("BasePositionId") + .HasColumnType("uniqueidentifier"); + + b.Property("Created") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Discipline") + .HasColumnType("nvarchar(max)"); + + b.Property("LocationId") + .HasColumnType("uniqueidentifier"); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("ResponsibleId") + .HasColumnType("uniqueidentifier"); + + b.Property("Sector") + .HasColumnType("nvarchar(max)"); + + b.Property("Unit") + .HasColumnType("nvarchar(max)"); + + b.Property("Updated") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedById") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("ProjectId"); + + b.HasIndex("ResponsibleId"); + + b.HasIndex("UpdatedById"); + + b.ToTable("ResponsibilityMatrices"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedById") + .HasColumnType("uniqueidentifier"); + + b.Property("CreatedDate") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("Number") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Number")); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("Title") + .IsRequired() + .HasMaxLength(250) + .HasColumnType("nvarchar(250)"); + + b.HasKey("Id"); + + b.HasIndex("CreatedById"); + + b.HasIndex("RequestId"); + + b.ToTable("SecondOpinions"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionResponse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AnsweredAt") + .HasColumnType("datetimeoffset"); + + b.Property("AssignedToId") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasMaxLength(2000) + .HasColumnType("nvarchar(2000)"); + + b.Property("CreatedDate") + .HasColumnType("datetimeoffset"); + + b.Property("PromptId") + .HasColumnType("uniqueidentifier"); + + b.Property("State") + .IsRequired() + .HasMaxLength(64) + .HasColumnType("nvarchar(64)"); + + b.HasKey("Id"); + + b.HasIndex("AssignedToId"); + + b.HasIndex("PromptId"); + + b.ToTable("SecondOpinionResponses", (string)null); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSharedRequest", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("GrantedAt") + .HasColumnType("datetimeoffset"); + + b.Property("IsRevoked") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("Reason") + .IsRequired() + .HasMaxLength(1000) + .HasColumnType("nvarchar(1000)"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("RevokedAt") + .HasColumnType("datetimeoffset"); + + b.Property("Scope") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("SharedById") + .HasColumnType("uniqueidentifier"); + + b.Property("SharedWithId") + .HasColumnType("uniqueidentifier"); + + b.Property("Source") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("RequestId"); + + b.HasIndex("SharedById"); + + b.HasIndex("SharedWithId", "RequestId", "IsRevoked"); + + b.ToTable("SharedRequests"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Completed") + .HasColumnType("datetimeoffset"); + + b.Property("Created") + .HasColumnType("datetimeoffset"); + + b.Property("LogicAppName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LogicAppVersion") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RequestId") + .HasColumnType("uniqueidentifier"); + + b.Property("RequestType") + .HasColumnType("int"); + + b.Property("State") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SystemMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("TerminatedbyId") + .HasColumnType("uniqueidentifier"); + + b.Property("WorkflowClassType") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("TerminatedbyId"); + + b.HasIndex("RequestId", "RequestType"); + + b.ToTable("Workflows"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflowStep", b => + { + b.Property("Id") + .HasColumnType("nvarchar(450)"); + + b.Property("WorkflowId") + .HasColumnType("uniqueidentifier"); + + b.Property("Completed") + .HasColumnType("datetimeoffset"); + + b.Property("CompletedById") + .HasColumnType("uniqueidentifier"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DueDate") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NextStep") + .HasColumnType("nvarchar(max)"); + + b.Property("PreviousStep") + .HasColumnType("nvarchar(max)"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("Started") + .HasColumnType("datetimeoffset"); + + b.Property("State") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id", "WorkflowId"); + + b.HasIndex("CompletedById"); + + b.HasIndex("WorkflowId"); + + b.ToTable("DbWorkflowStep"); + }); + + modelBuilder.Entity("DbPersonDbResourceAllocationRequest", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", null) + .WithMany() + .HasForeignKey("CandidatesForRequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", null) + .WithMany() + .HasForeignKey("CandidatesId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbConversationMessage", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", null) + .WithMany("Conversation") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Sender") + .WithMany() + .HasForeignKey("SenderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Sender"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonAbsence", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Person") + .WithMany() + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.OwnsOne("Fusion.Resources.Database.Entities.DbOpTaskDetails", "TaskDetails", b1 => + { + b1.Property("DbPersonAbsenceId") + .HasColumnType("uniqueidentifier"); + + b1.Property("BasePositionId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Location") + .HasColumnType("nvarchar(max)"); + + b1.Property("RoleName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.Property("TaskName") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DbPersonAbsenceId"); + + b1.ToTable("PersonAbsences"); + + b1.WithOwner() + .HasForeignKey("DbPersonAbsenceId"); + }); + + b.Navigation("CreatedBy"); + + b.Navigation("Person"); + + b.Navigation("TaskDetails"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonNote", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestAction", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "AssignedTo") + .WithMany() + .HasForeignKey("AssignedToId"); + + b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", "Request") + .WithMany("Actions") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "ResolvedBy") + .WithMany() + .HasForeignKey("ResolvedById"); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "SentBy") + .WithMany() + .HasForeignKey("SentById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AssignedTo"); + + b.Navigation("Request"); + + b.Navigation("ResolvedBy"); + + b.Navigation("SentBy"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestComment", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById"); + + b.Navigation("CreatedBy"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Restrict); + + b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpPositionInstance", "OrgPositionInstance", b1 => + { + b1.Property("DbResourceAllocationRequestId") + .HasColumnType("uniqueidentifier"); + + b1.Property("AppliesFrom") + .HasColumnType("datetime2"); + + b1.Property("AppliesTo") + .HasColumnType("datetime2"); + + b1.Property("AssignedToMail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("AssignedToUniqueId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("LocationId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Obs") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("Workload") + .HasColumnType("float"); + + b1.HasKey("DbResourceAllocationRequestId"); + + b1.ToTable("ResourceAllocationRequests"); + + b1.WithOwner() + .HasForeignKey("DbResourceAllocationRequestId"); + }); + + b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpProposalParameters", "ProposalParameters", b1 => + { + b1.Property("DbResourceAllocationRequestId") + .HasColumnType("uniqueidentifier"); + + b1.Property("ChangeFrom") + .HasColumnType("datetime2"); + + b1.Property("ChangeTo") + .HasColumnType("datetime2"); + + b1.Property("ChangeType") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b1.Property("Scope") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DbResourceAllocationRequestId"); + + b1.ToTable("ResourceAllocationRequests"); + + b1.WithOwner() + .HasForeignKey("DbResourceAllocationRequestId"); + }); + + b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpProposedPerson", "ProposedPerson", b1 => + { + b1.Property("DbResourceAllocationRequestId") + .HasColumnType("uniqueidentifier"); + + b1.Property("AzureUniqueId") + .HasColumnType("uniqueidentifier"); + + b1.Property("HasBeenProposed") + .HasColumnType("bit"); + + b1.Property("Mail") + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b1.Property("ProposedAt") + .HasColumnType("datetimeoffset"); + + b1.Property("WasNotified") + .HasColumnType("bit"); + + b1.HasKey("DbResourceAllocationRequestId"); + + b1.ToTable("ResourceAllocationRequests"); + + b1.WithOwner() + .HasForeignKey("DbResourceAllocationRequestId"); + }); + + b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpProvisionStatus", "ProvisioningStatus", b1 => + { + b1.Property("DbResourceAllocationRequestId") + .HasColumnType("uniqueidentifier"); + + b1.Property("ErrorMessage") + .HasColumnType("nvarchar(max)"); + + b1.Property("ErrorPayload") + .HasColumnType("nvarchar(max)"); + + b1.Property("OrgInstanceId") + .HasColumnType("uniqueidentifier"); + + b1.Property("OrgPositionId") + .HasColumnType("uniqueidentifier"); + + b1.Property("OrgProjectId") + .HasColumnType("uniqueidentifier"); + + b1.Property("Provisioned") + .HasColumnType("datetimeoffset"); + + b1.Property("State") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DbResourceAllocationRequestId"); + + b1.ToTable("ResourceAllocationRequests"); + + b1.WithOwner() + .HasForeignKey("DbResourceAllocationRequestId"); + }); + + b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpState", "State", b1 => + { + b1.Property("DbResourceAllocationRequestId") + .HasColumnType("uniqueidentifier"); + + b1.Property("IsCompleted") + .HasColumnType("bit"); + + b1.Property("State") + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b1.HasKey("DbResourceAllocationRequestId"); + + b1.ToTable("ResourceAllocationRequests"); + + b1.WithOwner() + .HasForeignKey("DbResourceAllocationRequestId"); + }); + + b.Navigation("CreatedBy"); + + b.Navigation("OrgPositionInstance") + .IsRequired(); + + b.Navigation("Project"); + + b.Navigation("ProposalParameters") + .IsRequired(); + + b.Navigation("ProposedPerson") + .IsRequired(); + + b.Navigation("ProvisioningStatus") + .IsRequired(); + + b.Navigation("State") + .IsRequired(); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResponsibilityMatrix", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") + .WithMany() + .HasForeignKey("ProjectId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Responsible") + .WithMany() + .HasForeignKey("ResponsibleId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") + .WithMany() + .HasForeignKey("UpdatedById") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("CreatedBy"); + + b.Navigation("Project"); + + b.Navigation("Responsible"); + + b.Navigation("UpdatedBy"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedById") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", "Request") + .WithMany("SecondOpinions") + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CreatedBy"); + + b.Navigation("Request"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionResponse", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "AssignedTo") + .WithMany() + .HasForeignKey("AssignedToId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", "SecondOpinion") + .WithMany("Responses") + .HasForeignKey("PromptId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("AssignedTo"); + + b.Navigation("SecondOpinion"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSharedRequest", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", "Request") + .WithMany() + .HasForeignKey("RequestId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "SharedBy") + .WithMany() + .HasForeignKey("SharedById") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "SharedWith") + .WithMany() + .HasForeignKey("SharedWithId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Request"); + + b.Navigation("SharedBy"); + + b.Navigation("SharedWith"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflow", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "TerminatedBy") + .WithMany() + .HasForeignKey("TerminatedbyId"); + + b.Navigation("TerminatedBy"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflowStep", b => + { + b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CompletedBy") + .WithMany() + .HasForeignKey("CompletedById"); + + b.HasOne("Fusion.Resources.Database.Entities.DbWorkflow", "Workflow") + .WithMany("WorkflowSteps") + .HasForeignKey("WorkflowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CompletedBy"); + + b.Navigation("Workflow"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => + { + b.Navigation("Actions"); + + b.Navigation("Conversation"); + + b.Navigation("SecondOpinions"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", b => + { + b.Navigation("Responses"); + }); + + modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflow", b => + { + b.Navigation("WorkflowSteps"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs b/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs new file mode 100644 index 000000000..55dc55fef --- /dev/null +++ b/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs @@ -0,0 +1,409 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace Fusion.Resources.Database.Migrations +{ + /// + public partial class RemoveContractentities : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "ContractorRequests"); + + migrationBuilder.DropTable( + name: "ContractPersonnelReplacementChanges"); + + migrationBuilder.DropTable( + name: "DbPersonnelDiscipline"); + + migrationBuilder.DropTable( + name: "DelegatedRoles"); + + migrationBuilder.DropTable( + name: "ContractPersonnel"); + + migrationBuilder.DropTable( + name: "Contracts"); + + migrationBuilder.DropTable( + name: "ExternalPersonnel"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "ContractPersonnelReplacementChanges", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ChangeType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), + ContractId = table.Column(type: "uniqueidentifier", nullable: false), + Created = table.Column(type: "datetimeoffset", nullable: false), + CreatedBy = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + FromPerson = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + Message = table.Column(type: "nvarchar(max)", nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), + ToPerson = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), + UPN = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ContractPersonnelReplacementChanges", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Contracts", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AllocatedById = table.Column(type: "uniqueidentifier", nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), + Allocated = table.Column(type: "datetimeoffset", nullable: false), + ContractNumber = table.Column(type: "nvarchar(max)", nullable: false), + Name = table.Column(type: "nvarchar(max)", nullable: false), + OrgContractId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contracts", x => x.Id); + table.ForeignKey( + name: "FK_Contracts_Persons_AllocatedById", + column: x => x.AllocatedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contracts_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ExternalPersonnel", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + AccountStatus = table.Column(type: "nvarchar(max)", nullable: false), + AzureUniqueId = table.Column(type: "uniqueidentifier", nullable: true), + DawinciCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), + Deleted = table.Column(type: "datetimeoffset", nullable: true), + FirstName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + IsDeleted = table.Column(type: "bit", nullable: true), + JobTitle = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + LastName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + LinkedInProfile = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + Mail = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + PersonIdReplacements = table.Column(type: "nvarchar(max)", nullable: true), + Phone = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + PreferredContractMail = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), + UPN = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ExternalPersonnel", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "DelegatedRoles", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContractId = table.Column(type: "uniqueidentifier", nullable: false), + CreatedById = table.Column(type: "uniqueidentifier", nullable: false), + PersonId = table.Column(type: "uniqueidentifier", nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), + RecertifiedById = table.Column(type: "uniqueidentifier", nullable: true), + Classification = table.Column(type: "int", nullable: false), + Created = table.Column(type: "datetimeoffset", nullable: false), + RecertifiedDate = table.Column(type: "datetimeoffset", nullable: true), + Type = table.Column(type: "int", nullable: false), + ValidTo = table.Column(type: "datetimeoffset", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DelegatedRoles", x => x.Id); + table.ForeignKey( + name: "FK_DelegatedRoles_Contracts_ContractId", + column: x => x.ContractId, + principalTable: "Contracts", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_DelegatedRoles_Persons_CreatedById", + column: x => x.CreatedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_DelegatedRoles_Persons_PersonId", + column: x => x.PersonId, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_DelegatedRoles_Persons_RecertifiedById", + column: x => x.RecertifiedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_DelegatedRoles_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ContractPersonnel", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContractId = table.Column(type: "uniqueidentifier", nullable: false), + CreatedById = table.Column(type: "uniqueidentifier", nullable: false), + PersonId = table.Column(type: "uniqueidentifier", nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), + UpdatedById = table.Column(type: "uniqueidentifier", nullable: true), + Created = table.Column(type: "datetimeoffset", nullable: false), + Updated = table.Column(type: "datetimeoffset", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ContractPersonnel", x => x.Id); + table.ForeignKey( + name: "FK_ContractPersonnel_Contracts_ContractId", + column: x => x.ContractId, + principalTable: "Contracts", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ContractPersonnel_ExternalPersonnel_PersonId", + column: x => x.PersonId, + principalTable: "ExternalPersonnel", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContractPersonnel_Persons_CreatedById", + column: x => x.CreatedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ContractPersonnel_Persons_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ContractPersonnel_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "DbPersonnelDiscipline", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + DbExternalPersonnelPersonId = table.Column(type: "uniqueidentifier", nullable: true), + Name = table.Column(type: "nvarchar(max)", nullable: false), + PersonnelId = table.Column(type: "uniqueidentifier", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DbPersonnelDiscipline", x => x.Id); + table.ForeignKey( + name: "FK_DbPersonnelDiscipline_ExternalPersonnel_DbExternalPersonnelPersonId", + column: x => x.DbExternalPersonnelPersonId, + principalTable: "ExternalPersonnel", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ContractorRequests", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + ContractId = table.Column(type: "uniqueidentifier", nullable: false), + CreatedById = table.Column(type: "uniqueidentifier", nullable: false), + PersonId = table.Column(type: "uniqueidentifier", nullable: false), + ProjectId = table.Column(type: "uniqueidentifier", nullable: false), + UpdatedById = table.Column(type: "uniqueidentifier", nullable: true), + Category = table.Column(type: "nvarchar(max)", nullable: false), + Created = table.Column(type: "datetimeoffset", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + LastActivity = table.Column(type: "datetimeoffset", nullable: false, defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))), + OriginalPositionId = table.Column(type: "uniqueidentifier", nullable: true), + State = table.Column(type: "nvarchar(max)", nullable: false), + Updated = table.Column(type: "datetimeoffset", nullable: true), + Position_AppliesFrom = table.Column(type: "datetime2", nullable: false), + Position_AppliesTo = table.Column(type: "datetime2", nullable: false), + Position_BasePositionId = table.Column(type: "uniqueidentifier", nullable: false), + Position_Name = table.Column(type: "nvarchar(max)", nullable: false), + Position_Obs = table.Column(type: "nvarchar(max)", nullable: true), + Position_Workload = table.Column(type: "float", nullable: false), + Position_TaskOwner_PositionId = table.Column(type: "uniqueidentifier", nullable: true), + Position_TaskOwner_RequestId = table.Column(type: "uniqueidentifier", nullable: true), + ProvisioningStatus_ErrorMessage = table.Column(type: "nvarchar(max)", nullable: true), + ProvisioningStatus_ErrorPayload = table.Column(type: "nvarchar(max)", nullable: true), + ProvisioningStatus_PositionId = table.Column(type: "uniqueidentifier", nullable: true), + ProvisioningStatus_Provisioned = table.Column(type: "datetimeoffset", nullable: true), + ProvisioningStatus_State = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ContractorRequests", x => x.Id); + table.ForeignKey( + name: "FK_ContractorRequests_ContractPersonnel_PersonId", + column: x => x.PersonId, + principalTable: "ContractPersonnel", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContractorRequests_Contracts_ContractId", + column: x => x.ContractId, + principalTable: "Contracts", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ContractorRequests_Persons_CreatedById", + column: x => x.CreatedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ContractorRequests_Persons_UpdatedById", + column: x => x.UpdatedById, + principalTable: "Persons", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_ContractorRequests_Projects_ProjectId", + column: x => x.ProjectId, + principalTable: "Projects", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_ContractorRequests_ContractId", + table: "ContractorRequests", + column: "ContractId"); + + migrationBuilder.CreateIndex( + name: "IX_ContractorRequests_CreatedById", + table: "ContractorRequests", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContractorRequests_LastActivity", + table: "ContractorRequests", + column: "LastActivity") + .Annotation("SqlServer:Clustered", false); + + migrationBuilder.CreateIndex( + name: "IX_ContractorRequests_PersonId", + table: "ContractorRequests", + column: "PersonId"); + + migrationBuilder.CreateIndex( + name: "IX_ContractorRequests_ProjectId", + table: "ContractorRequests", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContractorRequests_UpdatedById", + table: "ContractorRequests", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContractPersonnel_ContractId", + table: "ContractPersonnel", + column: "ContractId"); + + migrationBuilder.CreateIndex( + name: "IX_ContractPersonnel_CreatedById", + table: "ContractPersonnel", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContractPersonnel_PersonId", + table: "ContractPersonnel", + column: "PersonId"); + + migrationBuilder.CreateIndex( + name: "IX_ContractPersonnel_ProjectId", + table: "ContractPersonnel", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_ContractPersonnel_UpdatedById", + table: "ContractPersonnel", + column: "UpdatedById"); + + migrationBuilder.CreateIndex( + name: "IX_ContractPersonnelReplacementChanges_ProjectId_ContractId", + table: "ContractPersonnelReplacementChanges", + columns: new[] { "ProjectId", "ContractId" }) + .Annotation("SqlServer:Clustered", false) + .Annotation("SqlServer:Include", new[] { "UPN", "FromPerson", "ToPerson", "ChangeType", "Created", "CreatedBy" }); + + migrationBuilder.CreateIndex( + name: "IX_Contracts_AllocatedById", + table: "Contracts", + column: "AllocatedById"); + + migrationBuilder.CreateIndex( + name: "IX_Contracts_ProjectId", + table: "Contracts", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_DbPersonnelDiscipline_DbExternalPersonnelPersonId", + table: "DbPersonnelDiscipline", + column: "DbExternalPersonnelPersonId"); + + migrationBuilder.CreateIndex( + name: "IX_DelegatedRoles_ContractId", + table: "DelegatedRoles", + column: "ContractId"); + + migrationBuilder.CreateIndex( + name: "IX_DelegatedRoles_CreatedById", + table: "DelegatedRoles", + column: "CreatedById"); + + migrationBuilder.CreateIndex( + name: "IX_DelegatedRoles_PersonId", + table: "DelegatedRoles", + column: "PersonId"); + + migrationBuilder.CreateIndex( + name: "IX_DelegatedRoles_ProjectId", + table: "DelegatedRoles", + column: "ProjectId"); + + migrationBuilder.CreateIndex( + name: "IX_DelegatedRoles_RecertifiedById", + table: "DelegatedRoles", + column: "RecertifiedById"); + + migrationBuilder.CreateIndex( + name: "IX_ExternalPersonnel_Mail", + table: "ExternalPersonnel", + column: "Mail") + .Annotation("SqlServer:Clustered", false); + } + } +} diff --git a/src/backend/api/Fusion.Resources.Database/Migrations/ResourcesDbContextModelSnapshot.cs b/src/backend/api/Fusion.Resources.Database/Migrations/ResourcesDbContextModelSnapshot.cs index c86a29b4c..88a6bd0e2 100644 --- a/src/backend/api/Fusion.Resources.Database/Migrations/ResourcesDbContextModelSnapshot.cs +++ b/src/backend/api/Fusion.Resources.Database/Migrations/ResourcesDbContextModelSnapshot.cs @@ -17,10 +17,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "6.0.13") + .HasAnnotation("ProductVersion", "7.0.12") .HasAnnotation("Relational:MaxIdentifierLength", 128); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1); + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); modelBuilder.Entity("DbPersonDbResourceAllocationRequest", b => { @@ -37,197 +37,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("DbPersonDbResourceAllocationRequest"); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContract", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Allocated") - .HasColumnType("datetimeoffset"); - - b.Property("AllocatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("ContractNumber") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("OrgContractId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AllocatedById"); - - b.HasIndex("ProjectId"); - - b.ToTable("Contracts"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContractorRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Category") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ContractId") - .HasColumnType("uniqueidentifier"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("LastActivity") - .ValueGeneratedOnAdd() - .HasColumnType("datetimeoffset") - .HasDefaultValue(new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))); - - b.Property("OriginalPositionId") - .HasColumnType("uniqueidentifier"); - - b.Property("PersonId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("State") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetimeoffset"); - - b.Property("UpdatedById") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("LastActivity"); - - SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("LastActivity"), false); - - b.HasIndex("PersonId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UpdatedById"); - - b.ToTable("ContractorRequests"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContractPersonnel", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ContractId") - .HasColumnType("uniqueidentifier"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("PersonId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("Updated") - .HasColumnType("datetimeoffset"); - - b.Property("UpdatedById") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("PersonId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UpdatedById"); - - b.ToTable("ContractPersonnel"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContractPersonnelReplacement", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ChangeType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ContractId") - .HasColumnType("uniqueidentifier"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedBy") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("FromPerson") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Message") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("ToPerson") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("UPN") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.HasKey("Id"); - - b.HasIndex("ProjectId", "ContractId"); - - SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("ProjectId", "ContractId"), false); - SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("ProjectId", "ContractId"), new[] { "UPN", "FromPerson", "ToPerson", "ChangeType", "Created", "CreatedBy" }); - - b.ToTable("ContractPersonnelReplacementChanges"); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbConversationMessage", b => { b.Property("Id") @@ -356,133 +165,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("DelegatedDepartmentResponsiblesHistory"); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbDelegatedRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Classification") - .HasColumnType("int"); - - b.Property("ContractId") - .HasColumnType("uniqueidentifier"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("PersonId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("RecertifiedById") - .HasColumnType("uniqueidentifier"); - - b.Property("RecertifiedDate") - .HasColumnType("datetimeoffset"); - - b.Property("Type") - .HasColumnType("int"); - - b.Property("ValidTo") - .HasColumnType("datetimeoffset"); - - b.HasKey("Id"); - - b.HasIndex("ContractId"); - - b.HasIndex("CreatedById"); - - b.HasIndex("PersonId"); - - b.HasIndex("ProjectId"); - - b.HasIndex("RecertifiedById"); - - b.ToTable("DelegatedRoles"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbExternalPersonnelPerson", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccountStatus") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("AzureUniqueId") - .HasColumnType("uniqueidentifier"); - - b.Property("DawinciCode") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("Deleted") - .HasColumnType("datetimeoffset"); - - b.Property("FirstName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("IsDeleted") - .HasColumnType("bit"); - - b.Property("JobTitle") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("LastName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("LinkedInProfile") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Mail") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PersonIdReplacements") - .HasColumnType("nvarchar(max)"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(30) - .HasColumnType("nvarchar(30)"); - - b.Property("PreferredContractMail") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UPN") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.HasKey("Id"); - - b.HasIndex("Mail"); - - SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("Mail"), false); - - b.ToTable("ExternalPersonnel"); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPerson", b => { b.Property("Id") @@ -564,29 +246,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PersonAbsences"); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonnelDiscipline", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("DbExternalPersonnelPersonId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("PersonnelId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("DbExternalPersonnelPersonId"); - - b.ToTable("DbPersonnelDiscipline"); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonNote", b => { b.Property("Id") @@ -811,7 +470,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("bigint"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RequestNumber"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RequestNumber")); b.Property("RequestOwner") .IsRequired() @@ -915,7 +574,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .ValueGeneratedOnAdd() .HasColumnType("int"); - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Number"), 1L, 1); + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Number")); b.Property("RequestId") .HasColumnType("uniqueidentifier"); @@ -1134,198 +793,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) .IsRequired(); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContract", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "AllocatedBy") - .WithMany() - .HasForeignKey("AllocatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") - .WithMany("Contracts") - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("AllocatedBy"); - - b.Navigation("Project"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContractorRequest", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbContract", "Contract") - .WithMany() - .HasForeignKey("ContractId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbContractPersonnel", "Person") - .WithMany() - .HasForeignKey("PersonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Restrict); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbContractorRequest+ProvisionStatus", "ProvisioningStatus", b1 => - { - b1.Property("DbContractorRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ErrorMessage") - .HasColumnType("nvarchar(max)"); - - b1.Property("ErrorPayload") - .HasColumnType("nvarchar(max)"); - - b1.Property("PositionId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Provisioned") - .HasColumnType("datetimeoffset"); - - b1.Property("State") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("DbContractorRequestId"); - - b1.ToTable("ContractorRequests"); - - b1.WithOwner() - .HasForeignKey("DbContractorRequestId"); - }); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbContractorRequest+RequestPosition", "Position", b1 => - { - b1.Property("DbContractorRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("AppliesFrom") - .HasColumnType("datetime2"); - - b1.Property("AppliesTo") - .HasColumnType("datetime2"); - - b1.Property("BasePositionId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.Property("Obs") - .HasColumnType("nvarchar(max)"); - - b1.Property("Workload") - .HasColumnType("float"); - - b1.HasKey("DbContractorRequestId"); - - b1.ToTable("ContractorRequests"); - - b1.WithOwner() - .HasForeignKey("DbContractorRequestId"); - - b1.OwnsOne("Fusion.Resources.Database.Entities.DbContractorRequest+PositionTaskOwner", "TaskOwner", b2 => - { - b2.Property("RequestPositionDbContractorRequestId") - .HasColumnType("uniqueidentifier"); - - b2.Property("PositionId") - .HasColumnType("uniqueidentifier"); - - b2.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b2.HasKey("RequestPositionDbContractorRequestId"); - - b2.ToTable("ContractorRequests"); - - b2.WithOwner() - .HasForeignKey("RequestPositionDbContractorRequestId"); - }); - - b1.Navigation("TaskOwner") - .IsRequired(); - }); - - b.Navigation("Contract"); - - b.Navigation("CreatedBy"); - - b.Navigation("Person"); - - b.Navigation("Position") - .IsRequired(); - - b.Navigation("Project"); - - b.Navigation("ProvisioningStatus") - .IsRequired(); - - b.Navigation("UpdatedBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbContractPersonnel", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbContract", "Contract") - .WithMany() - .HasForeignKey("ContractId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbExternalPersonnelPerson", "Person") - .WithMany() - .HasForeignKey("PersonId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Contract"); - - b.Navigation("CreatedBy"); - - b.Navigation("Person"); - - b.Navigation("Project"); - - b.Navigation("UpdatedBy"); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbConversationMessage", b => { b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", null) @@ -1343,48 +810,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Sender"); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbDelegatedRole", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbContract", "Contract") - .WithMany() - .HasForeignKey("ContractId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Person") - .WithMany() - .HasForeignKey("PersonId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "RecertifiedBy") - .WithMany() - .HasForeignKey("RecertifiedById") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Contract"); - - b.Navigation("CreatedBy"); - - b.Navigation("Person"); - - b.Navigation("Project"); - - b.Navigation("RecertifiedBy"); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonAbsence", b => { b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") @@ -1432,14 +857,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("TaskDetails"); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonnelDiscipline", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbExternalPersonnelPerson", null) - .WithMany("Disciplines") - .HasForeignKey("DbExternalPersonnelPersonId") - .OnDelete(DeleteBehavior.Cascade); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonNote", b => { b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") @@ -1813,16 +1230,6 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Navigation("Workflow"); }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbExternalPersonnelPerson", b => - { - b.Navigation("Disciplines"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbProject", b => - { - b.Navigation("Contracts"); - }); - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => { b.Navigation("Actions"); diff --git a/src/backend/api/Fusion.Resources.Database/ResourcesDbContext.cs b/src/backend/api/Fusion.Resources.Database/ResourcesDbContext.cs index 190f3a182..9249601c1 100644 --- a/src/backend/api/Fusion.Resources.Database/ResourcesDbContext.cs +++ b/src/backend/api/Fusion.Resources.Database/ResourcesDbContext.cs @@ -22,7 +22,6 @@ public ResourcesDbContext(DbContextOptions options, ISqlAuth } public DbSet Persons { get; set; } - public DbSet Contracts { get; set; } public DbSet Projects { get; set; } public DbSet RequestComments { get; set; } public DbSet ResourceAllocationRequests { get; set; } @@ -38,16 +37,6 @@ public ResourcesDbContext(DbContextOptions options, ISqlAuth public DbSet DelegatedDepartmentResponsibles { get; set; } public DbSet DelegatedDepartmentResponsiblesHistory { get; set; } - - #region Moved to Contract Personnel. Only here for historical reasons - public DbSet ContractPersonnelReplacementChanges { get; set; } - public DbSet ContractPersonnel { get; set; } - public DbSet ContractorRequests { get; set; } - public DbSet ExternalPersonnel { get; set; } - public DbSet DelegatedRoles { get; set; } - #endregion - - protected override void OnModelCreating(ModelBuilder modelBuilder) { DbWorkflow.OnModelCreating(modelBuilder); @@ -60,19 +49,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) DbResourceAllocationRequest.OnModelCreating(modelBuilder); DbRequestAction.OnModelCreating(modelBuilder); DbConversationMessage.OnModelCreating(modelBuilder); - DbContractPersonnelReplacement.OnModelCreating(modelBuilder); DbSharedRequest.OnModelCreating(modelBuilder); DbSecondOpinionPrompt.OnModelCreating(modelBuilder); DbSecondOpinionResponse.OnModelCreating(modelBuilder); - #region Moved to Contract Personnel. Only here for historical reasons - DbContractPersonnel.OnModelCreating(modelBuilder); - DbContractorRequest.OnModelCreating(modelBuilder); - DbExternalPersonnelPerson.OnModelCreating(modelBuilder); - DbDelegatedRole.OnModelCreating(modelBuilder); DbDelegatedDepartmentResponsible.OnModelCreating(modelBuilder); DbDelegatedDepartmentResponsibleHistory.OnModelCreating(modelBuilder); - #endregion } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) From 38947368f28f95bd842b7398296384c801ea61f2 Mon Sep 17 00:00:00 2001 From: terjebra Date: Mon, 4 Nov 2024 17:45:57 +0100 Subject: [PATCH 2/2] Remove old migrations --- ...41201_Remove Contract entities.Designer.cs | 1257 ----------------- ...20231221141201_Remove Contract entities.cs | 409 ------ 2 files changed, 1666 deletions(-) delete mode 100644 src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs delete mode 100644 src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs diff --git a/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs b/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs deleted file mode 100644 index 5000491f4..000000000 --- a/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.Designer.cs +++ /dev/null @@ -1,1257 +0,0 @@ -// -using System; -using Fusion.Resources.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Fusion.Resources.Database.Migrations -{ - [DbContext(typeof(ResourcesDbContext))] - [Migration("20231221141201_Remove Contract entities")] - partial class RemoveContractentities - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "7.0.12") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DbPersonDbResourceAllocationRequest", b => - { - b.Property("CandidatesForRequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("CandidatesId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("CandidatesForRequestId", "CandidatesId"); - - b.HasIndex("CandidatesId"); - - b.ToTable("DbPersonDbResourceAllocationRequest"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbConversationMessage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Body") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("Category") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("PropertiesJson") - .HasColumnType("nvarchar(max)"); - - b.Property("Recpient") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("SenderId") - .HasColumnType("uniqueidentifier"); - - b.Property("Sent") - .HasColumnType("datetimeoffset"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("RequestId"); - - b.HasIndex("SenderId"); - - b.ToTable("RequestConversations"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbDelegatedDepartmentResponsible", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("DateCreated") - .ValueGeneratedOnAdd() - .HasColumnType("datetimeoffset") - .HasDefaultValueSql("getutcdate()"); - - b.Property("DateFrom") - .HasColumnType("datetimeoffset"); - - b.Property("DateTo") - .HasColumnType("datetimeoffset"); - - b.Property("DateUpdated") - .ValueGeneratedOnAdd() - .HasColumnType("datetimeoffset") - .HasDefaultValueSql("getutcdate()"); - - b.Property("DepartmentId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Reason") - .HasColumnType("nvarchar(max)"); - - b.Property("ResponsibleAzureObjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedBy") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("DelegatedDepartmentResponsibles"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbDelegatedDepartmentResponsibleHistory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Archived") - .HasColumnType("datetimeoffset"); - - b.Property("DateCreated") - .HasColumnType("datetimeoffset"); - - b.Property("DateFrom") - .HasColumnType("datetimeoffset"); - - b.Property("DateTo") - .HasColumnType("datetimeoffset"); - - b.Property("DateUpdated") - .HasColumnType("datetimeoffset"); - - b.Property("DepartmentId") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Reason") - .HasColumnType("nvarchar(max)"); - - b.Property("ResponsibleAzureObjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("UpdatedBy") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("DelegatedDepartmentResponsiblesHistory"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPerson", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccountType") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("AzureUniqueId") - .HasColumnType("uniqueidentifier"); - - b.Property("JobTitle") - .HasColumnType("nvarchar(max)"); - - b.Property("Mail") - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Phone") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("AzureUniqueId") - .IsUnique(); - - b.HasIndex("Mail"); - - SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("Mail"), false); - - b.ToTable("Persons"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonAbsence", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AbsencePercentage") - .HasColumnType("float"); - - b.Property("AppliesFrom") - .HasColumnType("datetimeoffset"); - - b.Property("AppliesTo") - .HasColumnType("datetimeoffset"); - - b.Property("Comment") - .HasColumnType("nvarchar(max)"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("IsPrivate") - .HasColumnType("bit"); - - b.Property("PersonId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("PersonId"); - - b.ToTable("PersonAbsences"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonNote", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AzureUniqueId") - .HasColumnType("uniqueidentifier"); - - b.Property("Content") - .HasMaxLength(2500) - .HasColumnType("nvarchar(2500)"); - - b.Property("IsShared") - .HasColumnType("bit"); - - b.Property("Title") - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.Property("Updated") - .HasColumnType("datetimeoffset"); - - b.Property("UpdatedById") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AzureUniqueId"); - - SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("AzureUniqueId"), false); - SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("AzureUniqueId"), new[] { "Id", "Title", "Content", "IsShared", "Updated", "UpdatedById" }); - - b.HasIndex("UpdatedById"); - - b.ToTable("PersonNotes"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbProject", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("DomainId") - .HasColumnType("nvarchar(max)"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("OrgProjectId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.ToTable("Projects"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestAction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AssignedToId") - .HasColumnType("uniqueidentifier"); - - b.Property("Body") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("DueDate") - .HasColumnType("datetime2"); - - b.Property("IsRequired") - .IsRequired() - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValueSql("(0)"); - - b.Property("IsResolved") - .HasColumnType("bit"); - - b.Property("PropertiesJson") - .HasColumnType("nvarchar(max)"); - - b.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("ResolvedAt") - .HasColumnType("datetimeoffset"); - - b.Property("ResolvedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Responsible") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SentById") - .HasColumnType("uniqueidentifier"); - - b.Property("Source") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubType") - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Type") - .IsRequired() - .HasMaxLength(60) - .HasColumnType("nvarchar(60)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedToId"); - - b.HasIndex("RequestId"); - - b.HasIndex("ResolvedById"); - - b.HasIndex("SentById"); - - b.ToTable("RequestActions", (string)null); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestComment", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Origin") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("Updated") - .HasColumnType("datetimeoffset"); - - b.Property("UpdatedById") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("RequestId"); - - SqlServerIndexBuilderExtensions.IsClustered(b.HasIndex("RequestId"), false); - - b.HasIndex("UpdatedById"); - - b.ToTable("RequestComments"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AdditionalNote") - .HasColumnType("nvarchar(max)"); - - b.Property("AssignedDepartment") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CorrelationId") - .HasColumnType("uniqueidentifier"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Discipline") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("IsDraft") - .HasColumnType("bit"); - - b.Property("LastActivity") - .HasColumnType("datetimeoffset"); - - b.Property("OrgPositionId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.Property("ProposedChanges") - .HasColumnType("nvarchar(max)"); - - b.Property("RequestNumber") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RequestNumber")); - - b.Property("RequestOwner") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SubType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetimeoffset"); - - b.Property("UpdatedById") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ProjectId"); - - b.HasIndex("UpdatedById"); - - b.ToTable("ResourceAllocationRequests"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResponsibilityMatrix", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("BasePositionId") - .HasColumnType("uniqueidentifier"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Discipline") - .HasColumnType("nvarchar(max)"); - - b.Property("LocationId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProjectId") - .HasColumnType("uniqueidentifier"); - - b.Property("ResponsibleId") - .HasColumnType("uniqueidentifier"); - - b.Property("Sector") - .HasColumnType("nvarchar(max)"); - - b.Property("Unit") - .HasColumnType("nvarchar(max)"); - - b.Property("Updated") - .HasColumnType("datetimeoffset"); - - b.Property("UpdatedById") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("ProjectId"); - - b.HasIndex("ResponsibleId"); - - b.HasIndex("UpdatedById"); - - b.ToTable("ResponsibilityMatrices"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedById") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedDate") - .HasColumnType("datetimeoffset"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("Number") - .ValueGeneratedOnAdd() - .HasColumnType("int"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Number")); - - b.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("Title") - .IsRequired() - .HasMaxLength(250) - .HasColumnType("nvarchar(250)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedById"); - - b.HasIndex("RequestId"); - - b.ToTable("SecondOpinions"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionResponse", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AnsweredAt") - .HasColumnType("datetimeoffset"); - - b.Property("AssignedToId") - .HasColumnType("uniqueidentifier"); - - b.Property("Comment") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CreatedDate") - .HasColumnType("datetimeoffset"); - - b.Property("PromptId") - .HasColumnType("uniqueidentifier"); - - b.Property("State") - .IsRequired() - .HasMaxLength(64) - .HasColumnType("nvarchar(64)"); - - b.HasKey("Id"); - - b.HasIndex("AssignedToId"); - - b.HasIndex("PromptId"); - - b.ToTable("SecondOpinionResponses", (string)null); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSharedRequest", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("GrantedAt") - .HasColumnType("datetimeoffset"); - - b.Property("IsRevoked") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("Reason") - .IsRequired() - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("RevokedAt") - .HasColumnType("datetimeoffset"); - - b.Property("Scope") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("SharedById") - .HasColumnType("uniqueidentifier"); - - b.Property("SharedWithId") - .HasColumnType("uniqueidentifier"); - - b.Property("Source") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("RequestId"); - - b.HasIndex("SharedById"); - - b.HasIndex("SharedWithId", "RequestId", "IsRevoked"); - - b.ToTable("SharedRequests"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflow", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Completed") - .HasColumnType("datetimeoffset"); - - b.Property("Created") - .HasColumnType("datetimeoffset"); - - b.Property("LogicAppName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("LogicAppVersion") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("RequestId") - .HasColumnType("uniqueidentifier"); - - b.Property("RequestType") - .HasColumnType("int"); - - b.Property("State") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("SystemMessage") - .HasColumnType("nvarchar(max)"); - - b.Property("TerminatedbyId") - .HasColumnType("uniqueidentifier"); - - b.Property("WorkflowClassType") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.HasIndex("TerminatedbyId"); - - b.HasIndex("RequestId", "RequestType"); - - b.ToTable("Workflows"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflowStep", b => - { - b.Property("Id") - .HasColumnType("nvarchar(450)"); - - b.Property("WorkflowId") - .HasColumnType("uniqueidentifier"); - - b.Property("Completed") - .HasColumnType("datetimeoffset"); - - b.Property("CompletedById") - .HasColumnType("uniqueidentifier"); - - b.Property("Description") - .HasColumnType("nvarchar(max)"); - - b.Property("DueDate") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("NextStep") - .HasColumnType("nvarchar(max)"); - - b.Property("PreviousStep") - .HasColumnType("nvarchar(max)"); - - b.Property("Reason") - .HasColumnType("nvarchar(max)"); - - b.Property("Started") - .HasColumnType("datetimeoffset"); - - b.Property("State") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id", "WorkflowId"); - - b.HasIndex("CompletedById"); - - b.HasIndex("WorkflowId"); - - b.ToTable("DbWorkflowStep"); - }); - - modelBuilder.Entity("DbPersonDbResourceAllocationRequest", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", null) - .WithMany() - .HasForeignKey("CandidatesForRequestId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", null) - .WithMany() - .HasForeignKey("CandidatesId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbConversationMessage", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", null) - .WithMany("Conversation") - .HasForeignKey("RequestId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Sender") - .WithMany() - .HasForeignKey("SenderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Sender"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonAbsence", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Person") - .WithMany() - .HasForeignKey("PersonId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbOpTaskDetails", "TaskDetails", b1 => - { - b1.Property("DbPersonAbsenceId") - .HasColumnType("uniqueidentifier"); - - b1.Property("BasePositionId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Location") - .HasColumnType("nvarchar(max)"); - - b1.Property("RoleName") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.Property("TaskName") - .HasColumnType("nvarchar(max)"); - - b1.HasKey("DbPersonAbsenceId"); - - b1.ToTable("PersonAbsences"); - - b1.WithOwner() - .HasForeignKey("DbPersonAbsenceId"); - }); - - b.Navigation("CreatedBy"); - - b.Navigation("Person"); - - b.Navigation("TaskDetails"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbPersonNote", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("UpdatedBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestAction", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "AssignedTo") - .WithMany() - .HasForeignKey("AssignedToId"); - - b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", "Request") - .WithMany("Actions") - .HasForeignKey("RequestId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "ResolvedBy") - .WithMany() - .HasForeignKey("ResolvedById"); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "SentBy") - .WithMany() - .HasForeignKey("SentById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("AssignedTo"); - - b.Navigation("Request"); - - b.Navigation("ResolvedBy"); - - b.Navigation("SentBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbRequestComment", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") - .WithMany() - .HasForeignKey("UpdatedById"); - - b.Navigation("CreatedBy"); - - b.Navigation("UpdatedBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Restrict); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpPositionInstance", "OrgPositionInstance", b1 => - { - b1.Property("DbResourceAllocationRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("AppliesFrom") - .HasColumnType("datetime2"); - - b1.Property("AppliesTo") - .HasColumnType("datetime2"); - - b1.Property("AssignedToMail") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b1.Property("AssignedToUniqueId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Id") - .HasColumnType("uniqueidentifier"); - - b1.Property("LocationId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Obs") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b1.Property("Workload") - .HasColumnType("float"); - - b1.HasKey("DbResourceAllocationRequestId"); - - b1.ToTable("ResourceAllocationRequests"); - - b1.WithOwner() - .HasForeignKey("DbResourceAllocationRequestId"); - }); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpProposalParameters", "ProposalParameters", b1 => - { - b1.Property("DbResourceAllocationRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ChangeFrom") - .HasColumnType("datetime2"); - - b1.Property("ChangeTo") - .HasColumnType("datetime2"); - - b1.Property("ChangeType") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b1.Property("Scope") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("DbResourceAllocationRequestId"); - - b1.ToTable("ResourceAllocationRequests"); - - b1.WithOwner() - .HasForeignKey("DbResourceAllocationRequestId"); - }); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpProposedPerson", "ProposedPerson", b1 => - { - b1.Property("DbResourceAllocationRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("AzureUniqueId") - .HasColumnType("uniqueidentifier"); - - b1.Property("HasBeenProposed") - .HasColumnType("bit"); - - b1.Property("Mail") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b1.Property("ProposedAt") - .HasColumnType("datetimeoffset"); - - b1.Property("WasNotified") - .HasColumnType("bit"); - - b1.HasKey("DbResourceAllocationRequestId"); - - b1.ToTable("ResourceAllocationRequests"); - - b1.WithOwner() - .HasForeignKey("DbResourceAllocationRequestId"); - }); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpProvisionStatus", "ProvisioningStatus", b1 => - { - b1.Property("DbResourceAllocationRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("ErrorMessage") - .HasColumnType("nvarchar(max)"); - - b1.Property("ErrorPayload") - .HasColumnType("nvarchar(max)"); - - b1.Property("OrgInstanceId") - .HasColumnType("uniqueidentifier"); - - b1.Property("OrgPositionId") - .HasColumnType("uniqueidentifier"); - - b1.Property("OrgProjectId") - .HasColumnType("uniqueidentifier"); - - b1.Property("Provisioned") - .HasColumnType("datetimeoffset"); - - b1.Property("State") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b1.HasKey("DbResourceAllocationRequestId"); - - b1.ToTable("ResourceAllocationRequests"); - - b1.WithOwner() - .HasForeignKey("DbResourceAllocationRequestId"); - }); - - b.OwnsOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest+DbOpState", "State", b1 => - { - b1.Property("DbResourceAllocationRequestId") - .HasColumnType("uniqueidentifier"); - - b1.Property("IsCompleted") - .HasColumnType("bit"); - - b1.Property("State") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b1.HasKey("DbResourceAllocationRequestId"); - - b1.ToTable("ResourceAllocationRequests"); - - b1.WithOwner() - .HasForeignKey("DbResourceAllocationRequestId"); - }); - - b.Navigation("CreatedBy"); - - b.Navigation("OrgPositionInstance") - .IsRequired(); - - b.Navigation("Project"); - - b.Navigation("ProposalParameters") - .IsRequired(); - - b.Navigation("ProposedPerson") - .IsRequired(); - - b.Navigation("ProvisioningStatus") - .IsRequired(); - - b.Navigation("State") - .IsRequired(); - - b.Navigation("UpdatedBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResponsibilityMatrix", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbProject", "Project") - .WithMany() - .HasForeignKey("ProjectId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "Responsible") - .WithMany() - .HasForeignKey("ResponsibleId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "UpdatedBy") - .WithMany() - .HasForeignKey("UpdatedById") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("CreatedBy"); - - b.Navigation("Project"); - - b.Navigation("Responsible"); - - b.Navigation("UpdatedBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CreatedBy") - .WithMany() - .HasForeignKey("CreatedById") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", "Request") - .WithMany("SecondOpinions") - .HasForeignKey("RequestId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CreatedBy"); - - b.Navigation("Request"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionResponse", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "AssignedTo") - .WithMany() - .HasForeignKey("AssignedToId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", "SecondOpinion") - .WithMany("Responses") - .HasForeignKey("PromptId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("AssignedTo"); - - b.Navigation("SecondOpinion"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSharedRequest", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", "Request") - .WithMany() - .HasForeignKey("RequestId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "SharedBy") - .WithMany() - .HasForeignKey("SharedById") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "SharedWith") - .WithMany() - .HasForeignKey("SharedWithId") - .OnDelete(DeleteBehavior.NoAction) - .IsRequired(); - - b.Navigation("Request"); - - b.Navigation("SharedBy"); - - b.Navigation("SharedWith"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflow", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "TerminatedBy") - .WithMany() - .HasForeignKey("TerminatedbyId"); - - b.Navigation("TerminatedBy"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflowStep", b => - { - b.HasOne("Fusion.Resources.Database.Entities.DbPerson", "CompletedBy") - .WithMany() - .HasForeignKey("CompletedById"); - - b.HasOne("Fusion.Resources.Database.Entities.DbWorkflow", "Workflow") - .WithMany("WorkflowSteps") - .HasForeignKey("WorkflowId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("CompletedBy"); - - b.Navigation("Workflow"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbResourceAllocationRequest", b => - { - b.Navigation("Actions"); - - b.Navigation("Conversation"); - - b.Navigation("SecondOpinions"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbSecondOpinionPrompt", b => - { - b.Navigation("Responses"); - }); - - modelBuilder.Entity("Fusion.Resources.Database.Entities.DbWorkflow", b => - { - b.Navigation("WorkflowSteps"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs b/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs deleted file mode 100644 index 55dc55fef..000000000 --- a/src/backend/api/Fusion.Resources.Database/Migrations/20231221141201_Remove Contract entities.cs +++ /dev/null @@ -1,409 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace Fusion.Resources.Database.Migrations -{ - /// - public partial class RemoveContractentities : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "ContractorRequests"); - - migrationBuilder.DropTable( - name: "ContractPersonnelReplacementChanges"); - - migrationBuilder.DropTable( - name: "DbPersonnelDiscipline"); - - migrationBuilder.DropTable( - name: "DelegatedRoles"); - - migrationBuilder.DropTable( - name: "ContractPersonnel"); - - migrationBuilder.DropTable( - name: "Contracts"); - - migrationBuilder.DropTable( - name: "ExternalPersonnel"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "ContractPersonnelReplacementChanges", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ChangeType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - ContractId = table.Column(type: "uniqueidentifier", nullable: false), - Created = table.Column(type: "datetimeoffset", nullable: false), - CreatedBy = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - FromPerson = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - Message = table.Column(type: "nvarchar(max)", nullable: false), - ProjectId = table.Column(type: "uniqueidentifier", nullable: false), - ToPerson = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - UPN = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ContractPersonnelReplacementChanges", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Contracts", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - AllocatedById = table.Column(type: "uniqueidentifier", nullable: false), - ProjectId = table.Column(type: "uniqueidentifier", nullable: false), - Allocated = table.Column(type: "datetimeoffset", nullable: false), - ContractNumber = table.Column(type: "nvarchar(max)", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: false), - OrgContractId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Contracts", x => x.Id); - table.ForeignKey( - name: "FK_Contracts_Persons_AllocatedById", - column: x => x.AllocatedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Contracts_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ExternalPersonnel", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - AccountStatus = table.Column(type: "nvarchar(max)", nullable: false), - AzureUniqueId = table.Column(type: "uniqueidentifier", nullable: true), - DawinciCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - Deleted = table.Column(type: "datetimeoffset", nullable: true), - FirstName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - IsDeleted = table.Column(type: "bit", nullable: true), - JobTitle = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - LastName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - LinkedInProfile = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - Mail = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - PersonIdReplacements = table.Column(type: "nvarchar(max)", nullable: true), - Phone = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), - PreferredContractMail = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - UPN = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ExternalPersonnel", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "DelegatedRoles", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ContractId = table.Column(type: "uniqueidentifier", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - PersonId = table.Column(type: "uniqueidentifier", nullable: false), - ProjectId = table.Column(type: "uniqueidentifier", nullable: false), - RecertifiedById = table.Column(type: "uniqueidentifier", nullable: true), - Classification = table.Column(type: "int", nullable: false), - Created = table.Column(type: "datetimeoffset", nullable: false), - RecertifiedDate = table.Column(type: "datetimeoffset", nullable: true), - Type = table.Column(type: "int", nullable: false), - ValidTo = table.Column(type: "datetimeoffset", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DelegatedRoles", x => x.Id); - table.ForeignKey( - name: "FK_DelegatedRoles_Contracts_ContractId", - column: x => x.ContractId, - principalTable: "Contracts", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_DelegatedRoles_Persons_CreatedById", - column: x => x.CreatedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_DelegatedRoles_Persons_PersonId", - column: x => x.PersonId, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_DelegatedRoles_Persons_RecertifiedById", - column: x => x.RecertifiedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_DelegatedRoles_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "ContractPersonnel", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ContractId = table.Column(type: "uniqueidentifier", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - PersonId = table.Column(type: "uniqueidentifier", nullable: false), - ProjectId = table.Column(type: "uniqueidentifier", nullable: false), - UpdatedById = table.Column(type: "uniqueidentifier", nullable: true), - Created = table.Column(type: "datetimeoffset", nullable: false), - Updated = table.Column(type: "datetimeoffset", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ContractPersonnel", x => x.Id); - table.ForeignKey( - name: "FK_ContractPersonnel_Contracts_ContractId", - column: x => x.ContractId, - principalTable: "Contracts", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ContractPersonnel_ExternalPersonnel_PersonId", - column: x => x.PersonId, - principalTable: "ExternalPersonnel", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContractPersonnel_Persons_CreatedById", - column: x => x.CreatedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ContractPersonnel_Persons_UpdatedById", - column: x => x.UpdatedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ContractPersonnel_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "DbPersonnelDiscipline", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - DbExternalPersonnelPersonId = table.Column(type: "uniqueidentifier", nullable: true), - Name = table.Column(type: "nvarchar(max)", nullable: false), - PersonnelId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_DbPersonnelDiscipline", x => x.Id); - table.ForeignKey( - name: "FK_DbPersonnelDiscipline_ExternalPersonnel_DbExternalPersonnelPersonId", - column: x => x.DbExternalPersonnelPersonId, - principalTable: "ExternalPersonnel", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ContractorRequests", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ContractId = table.Column(type: "uniqueidentifier", nullable: false), - CreatedById = table.Column(type: "uniqueidentifier", nullable: false), - PersonId = table.Column(type: "uniqueidentifier", nullable: false), - ProjectId = table.Column(type: "uniqueidentifier", nullable: false), - UpdatedById = table.Column(type: "uniqueidentifier", nullable: true), - Category = table.Column(type: "nvarchar(max)", nullable: false), - Created = table.Column(type: "datetimeoffset", nullable: false), - Description = table.Column(type: "nvarchar(max)", nullable: true), - LastActivity = table.Column(type: "datetimeoffset", nullable: false, defaultValue: new DateTimeOffset(new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new TimeSpan(0, 0, 0, 0, 0))), - OriginalPositionId = table.Column(type: "uniqueidentifier", nullable: true), - State = table.Column(type: "nvarchar(max)", nullable: false), - Updated = table.Column(type: "datetimeoffset", nullable: true), - Position_AppliesFrom = table.Column(type: "datetime2", nullable: false), - Position_AppliesTo = table.Column(type: "datetime2", nullable: false), - Position_BasePositionId = table.Column(type: "uniqueidentifier", nullable: false), - Position_Name = table.Column(type: "nvarchar(max)", nullable: false), - Position_Obs = table.Column(type: "nvarchar(max)", nullable: true), - Position_Workload = table.Column(type: "float", nullable: false), - Position_TaskOwner_PositionId = table.Column(type: "uniqueidentifier", nullable: true), - Position_TaskOwner_RequestId = table.Column(type: "uniqueidentifier", nullable: true), - ProvisioningStatus_ErrorMessage = table.Column(type: "nvarchar(max)", nullable: true), - ProvisioningStatus_ErrorPayload = table.Column(type: "nvarchar(max)", nullable: true), - ProvisioningStatus_PositionId = table.Column(type: "uniqueidentifier", nullable: true), - ProvisioningStatus_Provisioned = table.Column(type: "datetimeoffset", nullable: true), - ProvisioningStatus_State = table.Column(type: "nvarchar(max)", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ContractorRequests", x => x.Id); - table.ForeignKey( - name: "FK_ContractorRequests_ContractPersonnel_PersonId", - column: x => x.PersonId, - principalTable: "ContractPersonnel", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ContractorRequests_Contracts_ContractId", - column: x => x.ContractId, - principalTable: "Contracts", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ContractorRequests_Persons_CreatedById", - column: x => x.CreatedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ContractorRequests_Persons_UpdatedById", - column: x => x.UpdatedById, - principalTable: "Persons", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_ContractorRequests_Projects_ProjectId", - column: x => x.ProjectId, - principalTable: "Projects", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_ContractorRequests_ContractId", - table: "ContractorRequests", - column: "ContractId"); - - migrationBuilder.CreateIndex( - name: "IX_ContractorRequests_CreatedById", - table: "ContractorRequests", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_ContractorRequests_LastActivity", - table: "ContractorRequests", - column: "LastActivity") - .Annotation("SqlServer:Clustered", false); - - migrationBuilder.CreateIndex( - name: "IX_ContractorRequests_PersonId", - table: "ContractorRequests", - column: "PersonId"); - - migrationBuilder.CreateIndex( - name: "IX_ContractorRequests_ProjectId", - table: "ContractorRequests", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContractorRequests_UpdatedById", - table: "ContractorRequests", - column: "UpdatedById"); - - migrationBuilder.CreateIndex( - name: "IX_ContractPersonnel_ContractId", - table: "ContractPersonnel", - column: "ContractId"); - - migrationBuilder.CreateIndex( - name: "IX_ContractPersonnel_CreatedById", - table: "ContractPersonnel", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_ContractPersonnel_PersonId", - table: "ContractPersonnel", - column: "PersonId"); - - migrationBuilder.CreateIndex( - name: "IX_ContractPersonnel_ProjectId", - table: "ContractPersonnel", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_ContractPersonnel_UpdatedById", - table: "ContractPersonnel", - column: "UpdatedById"); - - migrationBuilder.CreateIndex( - name: "IX_ContractPersonnelReplacementChanges_ProjectId_ContractId", - table: "ContractPersonnelReplacementChanges", - columns: new[] { "ProjectId", "ContractId" }) - .Annotation("SqlServer:Clustered", false) - .Annotation("SqlServer:Include", new[] { "UPN", "FromPerson", "ToPerson", "ChangeType", "Created", "CreatedBy" }); - - migrationBuilder.CreateIndex( - name: "IX_Contracts_AllocatedById", - table: "Contracts", - column: "AllocatedById"); - - migrationBuilder.CreateIndex( - name: "IX_Contracts_ProjectId", - table: "Contracts", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_DbPersonnelDiscipline_DbExternalPersonnelPersonId", - table: "DbPersonnelDiscipline", - column: "DbExternalPersonnelPersonId"); - - migrationBuilder.CreateIndex( - name: "IX_DelegatedRoles_ContractId", - table: "DelegatedRoles", - column: "ContractId"); - - migrationBuilder.CreateIndex( - name: "IX_DelegatedRoles_CreatedById", - table: "DelegatedRoles", - column: "CreatedById"); - - migrationBuilder.CreateIndex( - name: "IX_DelegatedRoles_PersonId", - table: "DelegatedRoles", - column: "PersonId"); - - migrationBuilder.CreateIndex( - name: "IX_DelegatedRoles_ProjectId", - table: "DelegatedRoles", - column: "ProjectId"); - - migrationBuilder.CreateIndex( - name: "IX_DelegatedRoles_RecertifiedById", - table: "DelegatedRoles", - column: "RecertifiedById"); - - migrationBuilder.CreateIndex( - name: "IX_ExternalPersonnel_Mail", - table: "ExternalPersonnel", - column: "Mail") - .Annotation("SqlServer:Clustered", false); - } - } -}