Files
TenWholeYears.Server/RecNet.Infrastructure/Persistence/Configurations/ProfileConfiguration.cs
2026-06-19 15:12:04 -05:00

36 lines
986 B
C#

using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using RecNet.Domain.Profiles;
namespace RecNet.Infrastructure.Persistence.Configurations;
public class ProfileConfiguration : IEntityTypeConfiguration<Profile>
{
public void Configure(EntityTypeBuilder<Profile> builder)
{
builder.HasKey(x => x.ProfileId);
builder.Property(x => x.Name)
.HasMaxLength(Profile.MaxNameLength)
.IsRequired();
builder.Property(x => x.Platform)
.HasConversion<string>()
.HasMaxLength(50)
.IsRequired();
builder.Property(x => x.PlatformId)
.HasMaxLength(50)
.IsRequired();
builder.Property(x => x.DeviceIds)
.HasColumnType("jsonb");
builder.Property(x => x.CreatedAt)
.IsRequired();
builder.HasIndex(x => new { x.Platform, x.PlatformId })
.IsUnique();
}
}