diff --git a/Covenant/Models/CovenantContext.cs b/Covenant/Models/CovenantContext.cs index d5d87e5b..e28851fc 100644 --- a/Covenant/Models/CovenantContext.cs +++ b/Covenant/Models/CovenantContext.cs @@ -107,7 +107,9 @@ protected override void OnModelCreating(ModelBuilder builder) builder.Entity() .HasMany(G => G.FolderRoots) - .WithOne(F => F.RootGrunt); + //.WithOne(F => F.RootGrunt); + .WithOne(F => F.RootGrunt) + .OnDelete(DeleteBehavior.Cascade); builder.Entity() .HasOne(N => N.Grunt) @@ -117,7 +119,9 @@ protected override void OnModelCreating(ModelBuilder builder) builder.Entity() .HasMany(F => F.Nodes) .WithOne() - .HasForeignKey(N => N.ParentId); + //.HasForeignKey(N => N.ParentId); + .HasForeignKey(N => N.ParentId) + .OnDelete(DeleteBehavior.Cascade); builder.Entity() .HasOne(GT => GT.Author)