39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
|
|
using Microsoft.EntityFrameworkCore;
|
||
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||
|
|
using WorkClub.Domain.Entities;
|
||
|
|
|
||
|
|
namespace WorkClub.Infrastructure.Data.Configurations;
|
||
|
|
|
||
|
|
public class ShiftSignupConfiguration : IEntityTypeConfiguration<ShiftSignup>
|
||
|
|
{
|
||
|
|
public void Configure(EntityTypeBuilder<ShiftSignup> builder)
|
||
|
|
{
|
||
|
|
builder.ToTable("shift_signups");
|
||
|
|
|
||
|
|
builder.HasKey(ss => ss.Id);
|
||
|
|
|
||
|
|
builder.Property(ss => ss.TenantId)
|
||
|
|
.IsRequired()
|
||
|
|
.HasMaxLength(200);
|
||
|
|
|
||
|
|
builder.Property(ss => ss.ShiftId)
|
||
|
|
.IsRequired();
|
||
|
|
|
||
|
|
builder.Property(ss => ss.MemberId)
|
||
|
|
.IsRequired();
|
||
|
|
|
||
|
|
builder.Property(ss => ss.SignedUpAt)
|
||
|
|
.IsRequired();
|
||
|
|
|
||
|
|
builder.HasIndex(ss => ss.TenantId)
|
||
|
|
.HasDatabaseName("ix_shift_signups_tenant_id");
|
||
|
|
|
||
|
|
builder.HasIndex(ss => ss.ShiftId)
|
||
|
|
.HasDatabaseName("ix_shift_signups_shift_id");
|
||
|
|
|
||
|
|
builder.HasIndex(ss => new { ss.ShiftId, ss.MemberId })
|
||
|
|
.IsUnique()
|
||
|
|
.HasDatabaseName("ix_shift_signups_shift_member");
|
||
|
|
}
|
||
|
|
}
|