fix: data deletion

This commit is contained in:
Polianin Nikita 2024-01-26 07:44:25 +03:00
parent e7c05b4a68
commit 194dd1b729

View File

@ -13,13 +13,13 @@ public class GroupConfiguration : IEntityTypeConfiguration<Group>
builder.HasIndex(g => g.Id).IsUnique();
builder.Property(g => g.Id).HasColumnType("INTEGER").IsRequired().ValueGeneratedOnAdd();
builder.Property(g => g.FacultyId).HasColumnType("INTEGER").IsRequired();
builder.Property(g => g.FacultyId).HasColumnType("INTEGER");
builder.Property(g => g.Name).HasColumnType("TEXT").IsRequired().HasMaxLength(64);
builder
.HasOne(g => g.Faculty)
.WithMany(u => u.Groups)
.HasForeignKey(d => d.FacultyId)
.OnDelete(DeleteBehavior.Restrict);
.OnDelete(DeleteBehavior.SetNull);
}
}