feat(dal): создана связь между JobGroup & UnitField. Отключено каскадное удаление для этой связи
This commit is contained in:
@@ -504,6 +504,15 @@ namespace PARR.DAL.Context
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region JobGroup - UnitField (откл каскадное удаление)
|
||||||
|
|
||||||
|
modelBuilder.Entity<JobGroup>()
|
||||||
|
.HasOne(t => t.GroupingUnitField)
|
||||||
|
.WithMany(t => t.JobGroupWithGrouping)
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||||
|
|||||||
3935
PARR.DAL/Migrations/20251218232909_addRel_JobGroup_UnitField.Designer.cs
generated
Normal file
3935
PARR.DAL/Migrations/20251218232909_addRel_JobGroup_UnitField.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,44 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PARR.DAL.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class addRel_JobGroup_UnitField : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Groups_GroupingUnitFieldId",
|
||||||
|
schema: "job",
|
||||||
|
table: "Groups",
|
||||||
|
column: "GroupingUnitFieldId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Groups_Fields_GroupingUnitFieldId",
|
||||||
|
schema: "job",
|
||||||
|
table: "Groups",
|
||||||
|
column: "GroupingUnitFieldId",
|
||||||
|
principalSchema: "unit",
|
||||||
|
principalTable: "Fields",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Restrict);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Groups_Fields_GroupingUnitFieldId",
|
||||||
|
schema: "job",
|
||||||
|
table: "Groups");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Groups_GroupingUnitFieldId",
|
||||||
|
schema: "job",
|
||||||
|
table: "Groups");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1713,6 +1713,8 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("GroupTypeId");
|
b.HasIndex("GroupTypeId");
|
||||||
|
|
||||||
|
b.HasIndex("GroupingUnitFieldId");
|
||||||
|
|
||||||
b.ToTable("Groups", "job", t =>
|
b.ToTable("Groups", "job", t =>
|
||||||
{
|
{
|
||||||
t.HasComment("Таблица описания групп работ, для реализации зонтиков");
|
t.HasComment("Таблица описания групп работ, для реализации зонтиков");
|
||||||
@@ -3358,7 +3360,14 @@ namespace PARR.DAL.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("PARR.DAL.Models.Unit.UnitField", "GroupingUnitField")
|
||||||
|
.WithMany("JobGroupWithGrouping")
|
||||||
|
.HasForeignKey("GroupingUnitFieldId")
|
||||||
|
.OnDelete(DeleteBehavior.Restrict);
|
||||||
|
|
||||||
b.Navigation("GroupType");
|
b.Navigation("GroupType");
|
||||||
|
|
||||||
|
b.Navigation("GroupingUnitField");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.Job.JobRelationshipFilter", b =>
|
modelBuilder.Entity("PARR.DAL.Models.Job.JobRelationshipFilter", b =>
|
||||||
@@ -3886,6 +3895,8 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b =>
|
modelBuilder.Entity("PARR.DAL.Models.Unit.UnitField", b =>
|
||||||
{
|
{
|
||||||
|
b.Navigation("JobGroupWithGrouping");
|
||||||
|
|
||||||
b.Navigation("RelationshipFilters");
|
b.Navigation("RelationshipFilters");
|
||||||
|
|
||||||
b.Navigation("UnitFieldValues");
|
b.Navigation("UnitFieldValues");
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Base;
|
using PARR.DAL.Models.Base;
|
||||||
|
using PARR.DAL.Models.Unit;
|
||||||
using PARR.DAL.Settings;
|
using PARR.DAL.Settings;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
@@ -127,6 +128,11 @@ namespace PARR.DAL.Models.Job
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid? GroupingUnitFieldId { get; set; }
|
public Guid? GroupingUnitFieldId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Поле по которому группируется (!!!отключено каскадное удаление!!!)
|
||||||
|
/// </summary>
|
||||||
|
[ForeignKey(nameof(GroupingUnitFieldId))]
|
||||||
|
public UnitField? GroupingUnitField { get; set; }
|
||||||
|
|
||||||
[ForeignKey(nameof(GroupTypeId))]
|
[ForeignKey(nameof(GroupTypeId))]
|
||||||
public JobGroupType? GroupType { get; set; }
|
public JobGroupType? GroupType { get; set; }
|
||||||
|
|||||||
@@ -60,5 +60,11 @@ namespace PARR.DAL.Models.Unit
|
|||||||
public ICollection<UnitFieldInUnitFieldValue> UnitFieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
public ICollection<UnitFieldInUnitFieldValue> UnitFieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
|
||||||
|
|
||||||
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
|
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// JobGroup которые группируются по этому полю (!!!отключено каскадное удаление!!!)
|
||||||
|
/// </summary>
|
||||||
|
public ICollection<JobGroup> JobGroupWithGrouping { get; set; } = new HashSet<JobGroup>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user