* generate (case-insensitive) unique names for fields that should be unique * move name case-insensitivity down to schema level * update changelog
26 lines
746 B
C#
26 lines
746 B
C#
using ErsatzTV.Core.Domain.Scheduling;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
namespace ErsatzTV.Infrastructure.Data.Configurations.Scheduling;
|
|
|
|
public class BlockGroupConfiguration : IEntityTypeConfiguration<BlockGroup>
|
|
{
|
|
public void Configure(EntityTypeBuilder<BlockGroup> builder)
|
|
{
|
|
builder.ToTable("BlockGroup");
|
|
|
|
builder.Property(b => b.Name)
|
|
.HasMaxLength(50)
|
|
.HasColumnType("varchar(50)");
|
|
|
|
builder.HasIndex(b => b.Name)
|
|
.IsUnique();
|
|
|
|
builder.HasMany(b => b.Blocks)
|
|
.WithOne(i => i.BlockGroup)
|
|
.HasForeignKey(i => i.BlockGroupId)
|
|
.OnDelete(DeleteBehavior.Cascade);
|
|
}
|
|
}
|