Skip to content

Commit

Permalink
Add Persons table (#870)
Browse files Browse the repository at this point in the history
  • Loading branch information
gunndabad authored Oct 25, 2023
1 parent d034b8f commit 5ef5c2c
Show file tree
Hide file tree
Showing 6 changed files with 842 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using TeachingRecordSystem.Core.DataStore.Postgres.Models;

namespace TeachingRecordSystem.Core.DataStore.Postgres.Mappings;

public class PersonMapping : IEntityTypeConfiguration<Person>
{
public void Configure(EntityTypeBuilder<Person> builder)
{
builder.ToTable("persons");
builder.HasKey(p => p.PersonId);
builder.HasIndex(p => p.DqtContactId).HasFilter("dqt_contact_id is not null").IsUnique();
builder.HasIndex(p => p.Trn).HasFilter("trn is not null").IsUnique();
builder.Property(p => p.Trn).HasMaxLength(7).IsFixedLength();
builder.Property(p => p.FirstName).HasMaxLength(100);
builder.Property(p => p.MiddleName).HasMaxLength(100);
builder.Property(p => p.LastName).HasMaxLength(100);
builder.Property(p => p.EmailAddress).HasMaxLength(100);
builder.Property(p => p.NationalInsuranceNumber).HasMaxLength(9).IsFixedLength();
builder.Property(p => p.DqtFirstName).HasMaxLength(100);
builder.Property(p => p.DqtMiddleName).HasMaxLength(100);
builder.Property(p => p.DqtLastName).HasMaxLength(100);
}
}
Loading

0 comments on commit 5ef5c2c

Please sign in to comment.