asentrafin/backend/Data/Configurations/PlaidItemConfiguration.cs

23 lines
829 B
C#

using Asentrafin.Api.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace Asentrafin.Api.Data.Configurations;
public class PlaidItemConfiguration : IEntityTypeConfiguration<PlaidItem>
{
public void Configure(EntityTypeBuilder<PlaidItem> builder)
{
builder.ToTable("plaid_items");
builder.HasKey(item => item.Id);
builder.Property(item => item.AccessToken).IsRequired();
builder.Property(item => item.PlaidItemId).HasMaxLength(128);
builder.Property(item => item.InstitutionId).HasMaxLength(128);
builder.Property(item => item.InstitutionName).HasMaxLength(256);
builder.Property(item => item.TransactionsCursor).HasMaxLength(512);
builder.HasIndex(item => item.PlaidItemId).IsUnique();
}
}