21 lines
1016 B
C#
21 lines
1016 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
|
|
|
public class ReplicaPatientConfiguration : IEntityTypeConfiguration<ReplicaPatient>
|
|
{
|
|
public void Configure(EntityTypeBuilder<ReplicaPatient> builder)
|
|
{
|
|
builder.ToTable("patients");
|
|
builder.HasKey(p => p.Id);
|
|
builder.Property(p => p.Id).HasColumnName("id").HasDefaultValueSql("gen_random_uuid()");
|
|
builder.Property(p => p.Mrn).HasColumnName("mrn").HasMaxLength(20).IsRequired();
|
|
builder.Property(p => p.FirstName).HasColumnName("first_name").HasMaxLength(100).IsRequired();
|
|
builder.Property(p => p.LastName).HasColumnName("last_name").HasMaxLength(100).IsRequired();
|
|
builder.Property(p => p.DateOfBirth).HasColumnName("date_of_birth");
|
|
builder.Property(p => p.Gender).HasColumnName("gender").HasMaxLength(10).IsRequired();
|
|
builder.Property(p => p.SyncedAt).HasColumnName("synced_at");
|
|
|
|
builder.HasIndex(p => p.Mrn).IsUnique();
|
|
}
|
|
}
|