diff --git a/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs b/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs index d66f708..40a6842 100644 --- a/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs +++ b/Data.SeaHavenIndustries/Auth/ApplicationDbContext.cs @@ -33,6 +33,24 @@ namespace Data.SeaHavenIndustries .HasIndex(u => new { u.DispatchId, u.Status }) .IsUnique() .HasFilter("[Status] = 'Pending'"); + + builder.Entity() + .HasIndex(l => new { l.WorkOrderId, l.FieldName }) + .IsUnique(); + + builder.Entity() + .Property(w => w.RowVersion) + .IsRowVersion(); + + builder.Entity() + .Property(d => d.RowVersion) + .IsRowVersion(); + + builder.Entity() + .HasOne(w => w.PrimaryDispatch) + .WithMany() + .HasForeignKey(w => w.PrimaryDispatchId) + .OnDelete(DeleteBehavior.Restrict); } public DbSet Categories { get; set; } public DbSet Locations { get; set; } @@ -47,6 +65,7 @@ namespace Data.SeaHavenIndustries public DbSet workOrderCategories { get; set; } public DbSet workOrderAttachments { get; set; } public DbSet WorkOrderAuditLogs { get; set; } + public DbSet WorkOrderFieldLocks { get; set; } public DbSet DropdownOptions { get; set; } public DbSet Vendors { get; set; } public DbSet VendorAccessTokens { get; set; } @@ -87,6 +106,8 @@ namespace Data.SeaHavenIndustries public DateTime? DeletedDate { get; set; } public bool? IsDeleted { get; set; } public string? UserImage { get; set; } + public string? Initials { get; set; } + public string? Color { get; set; } public int? Type { get; set; } // 1 for users 0 for admin public ICollection