Skip to content

Commit

Permalink
Merge pull request #24 from Hamed-Bagherpour/develop
Browse files Browse the repository at this point in the history
Update DB Context
  • Loading branch information
mahdidelzendeh72 authored Nov 11, 2023
2 parents 22a478b + 53e6a3f commit 5ec7f59
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
model.HasOne(u => u.Parent)
.WithMany(u => u.Parents)
.HasForeignKey(u => u.ParentId);
.HasForeignKey(u => u.ParentId)
.OnDelete(DeleteBehavior.Restrict);
model.HasOne(u => u.Child)
.WithMany(u => u.Children)
.HasForeignKey(u => u.ChildId);
.HasForeignKey(u => u.ChildId)
.OnDelete(DeleteBehavior.Restrict);
});

var result = base.AutoModelCreating(modelBuilder);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ protected override void Up(MigrationBuilder migrationBuilder)
column: x => x.ChildId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_RoleParentChildren_Roles_ParentId",
column: x => x.ParentId,
principalTable: "Roles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
onDelete: ReferentialAction.Restrict);
});

migrationBuilder.InsertData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,13 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasOne("EasyMicroservices.AuthenticationsMicroservice.Database.Entities.RoleEntity", "Child")
.WithMany("Children")
.HasForeignKey("ChildId")
.OnDelete(DeleteBehavior.Cascade)
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("EasyMicroservices.AuthenticationsMicroservice.Database.Entities.RoleEntity", "Parent")
.WithMany("Parents")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Cascade)
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Child");
Expand Down

0 comments on commit 5ec7f59

Please sign in to comment.