forked from ddrilling/AsbCloudServer
DB config WellOperations add OnDelete = SetNull behavior
This commit is contained in:
parent
bd0fd747af
commit
a8f7dbc4f4
8659
AsbCloudDb/Migrations/20230928055323_WellOperations_Add_OnDelete_SetNull_Behavior.Designer.cs
generated
Normal file
8659
AsbCloudDb/Migrations/20230928055323_WellOperations_Add_OnDelete_SetNull_Behavior.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,38 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AsbCloudDb.Migrations
|
||||
{
|
||||
public partial class WellOperations_Add_OnDelete_SetNull_Behavior : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_well_operation_t_well_operation_id_plan",
|
||||
table: "t_well_operation");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_well_operation_t_well_operation_id_plan",
|
||||
table: "t_well_operation",
|
||||
column: "id_plan",
|
||||
principalTable: "t_well_operation",
|
||||
principalColumn: "id",
|
||||
onDelete: ReferentialAction.SetNull);
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_t_well_operation_t_well_operation_id_plan",
|
||||
table: "t_well_operation");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_t_well_operation_t_well_operation_id_plan",
|
||||
table: "t_well_operation",
|
||||
column: "id_plan",
|
||||
principalTable: "t_well_operation",
|
||||
principalColumn: "id");
|
||||
}
|
||||
}
|
||||
}
|
@ -8408,7 +8408,8 @@ namespace AsbCloudDb.Migrations
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.WellOperation", "OperationPlan")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdPlan");
|
||||
.HasForeignKey("IdPlan")
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
|
||||
b.HasOne("AsbCloudDb.Model.Well", "Well")
|
||||
.WithMany("WellOperations")
|
||||
|
@ -277,6 +277,11 @@ namespace AsbCloudDb.Model
|
||||
{
|
||||
entity.HasIndex(d => d.DepthEnd);
|
||||
entity.HasIndex(d => d.DateStart);
|
||||
|
||||
entity.HasOne(o => o.OperationPlan)
|
||||
.WithMany()
|
||||
.HasForeignKey(o => o.IdPlan)
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DrillingProgramPart>(entity =>
|
||||
|
@ -66,7 +66,7 @@ namespace AsbCloudDb.Model
|
||||
|
||||
[JsonIgnore]
|
||||
[ForeignKey(nameof(IdPlan))]
|
||||
public virtual WellOperation OperationPlan { get; set; } = null!;
|
||||
public virtual WellOperation? OperationPlan { get; set; } = null!;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user