//
using System;
using Asentrafin.Api.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace Asentrafin.Api.Data.Migrations
{
[DbContext(typeof(AppDbContext))]
partial class AppDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasDefaultSchema("app")
.HasAnnotation("ProductVersion", "10.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidAccount", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AvailableBalance")
.HasColumnType("numeric");
b.Property("BalanceLastUpdatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("CurrentBalance")
.HasColumnType("numeric");
b.Property("IsoCurrencyCode")
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property("Limit")
.HasColumnType("numeric");
b.Property("Mask")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("OfficialName")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("PlaidAccountId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("PlaidItemId")
.HasColumnType("uuid");
b.Property("RawJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property("Subtype")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Type")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("UnofficialCurrencyCode")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("PlaidAccountId")
.IsUnique();
b.HasIndex("PlaidItemId");
b.ToTable("plaid_accounts", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidHolding", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CostBasis")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("InstitutionPrice")
.HasColumnType("numeric");
b.Property("InstitutionPriceAsOf")
.HasColumnType("date");
b.Property("InstitutionValue")
.HasColumnType("numeric");
b.Property("IsoCurrencyCode")
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property("PlaidAccountId")
.HasColumnType("uuid");
b.Property("PlaidItemId")
.HasColumnType("uuid");
b.Property("PlaidSecurityId")
.HasColumnType("uuid");
b.Property("Quantity")
.HasColumnType("numeric");
b.Property("RawJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property("UnofficialCurrencyCode")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("PlaidItemId");
b.HasIndex("PlaidSecurityId");
b.HasIndex("PlaidAccountId", "PlaidSecurityId")
.IsUnique();
b.ToTable("plaid_holdings", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidInvestmentTransaction", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AccountPlaidId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Amount")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Date")
.HasColumnType("date");
b.Property("Fees")
.HasColumnType("numeric");
b.Property("IsoCurrencyCode")
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property("Name")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("PlaidAccountId")
.HasColumnType("uuid");
b.Property("PlaidInvestmentTransactionId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("PlaidItemId")
.HasColumnType("uuid");
b.Property("PlaidSecurityId")
.HasColumnType("uuid");
b.Property("Price")
.HasColumnType("numeric");
b.Property("Quantity")
.HasColumnType("numeric");
b.Property("RawJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property("SecurityPlaidId")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Subtype")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("Type")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("UnofficialCurrencyCode")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("PlaidAccountId");
b.HasIndex("PlaidInvestmentTransactionId")
.IsUnique();
b.HasIndex("PlaidSecurityId");
b.HasIndex("PlaidItemId", "Date");
b.ToTable("plaid_investment_transactions", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidItem", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AccessToken")
.IsRequired()
.HasColumnType("text");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("InstitutionId")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("InstitutionName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("LastAccountsSyncedAt")
.HasColumnType("timestamp with time zone");
b.Property("LastInvestmentsSyncedAt")
.HasColumnType("timestamp with time zone");
b.Property("LastTransactionsSyncedAt")
.HasColumnType("timestamp with time zone");
b.Property("PlaidItemId")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("TransactionsCursor")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("PlaidItemId")
.IsUnique();
b.ToTable("plaid_items", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidSecurity", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("ClosePrice")
.HasColumnType("numeric");
b.Property("ClosePriceAsOf")
.HasColumnType("date");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Cusip")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("Isin")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("IsoCurrencyCode")
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property("Name")
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("PlaidSecurityId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("RawJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property("Sedol")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("TickerSymbol")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("Type")
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("UnofficialCurrencyCode")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("PlaidSecurityId")
.IsUnique();
b.ToTable("plaid_securities", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidTransaction", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("AccountPlaidId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Amount")
.HasColumnType("numeric");
b.Property("AuthorizedDate")
.HasColumnType("date");
b.PrimitiveCollection("Categories")
.IsRequired()
.HasColumnType("text[]");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Date")
.HasColumnType("date");
b.Property("IsoCurrencyCode")
.HasMaxLength(8)
.HasColumnType("character varying(8)");
b.Property("MerchantName")
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("Name")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("character varying(512)");
b.Property("Pending")
.HasColumnType("boolean");
b.Property("PersonalFinanceCategoryDetailed")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("PersonalFinanceCategoryPrimary")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("PlaidAccountId")
.HasColumnType("uuid");
b.Property("PlaidItemId")
.HasColumnType("uuid");
b.Property("PlaidTransactionId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("RawJson")
.IsRequired()
.HasColumnType("jsonb");
b.Property("RemovedAt")
.HasColumnType("timestamp with time zone");
b.Property("UnofficialCurrencyCode")
.HasMaxLength(32)
.HasColumnType("character varying(32)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("PlaidAccountId");
b.HasIndex("PlaidTransactionId")
.IsUnique();
b.HasIndex("PlaidItemId", "Date");
b.ToTable("plaid_transactions", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.TransactionCategory", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("IsSystem")
.HasColumnType("boolean");
b.Property("Name")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("ParentId")
.HasColumnType("uuid");
b.Property("PlaidDetailed")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("PlaidPrimary")
.HasMaxLength(128)
.HasColumnType("character varying(128)");
b.Property("Slug")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("character varying(256)");
b.Property("SortOrder")
.HasColumnType("integer");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("ParentId");
b.HasIndex("Slug")
.IsUnique();
b.HasIndex("PlaidPrimary", "PlaidDetailed");
b.ToTable("transaction_categories", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.TransactionClassification", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property("CategoryId")
.HasColumnType("uuid");
b.Property("Confidence")
.HasColumnType("numeric");
b.Property("CreatedAt")
.HasColumnType("timestamp with time zone");
b.Property("Notes")
.HasMaxLength(1024)
.HasColumnType("character varying(1024)");
b.Property("PlaidTransactionId")
.HasColumnType("uuid");
b.Property("Source")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("character varying(64)");
b.Property("UpdatedAt")
.HasColumnType("timestamp with time zone");
b.HasKey("Id");
b.HasIndex("CategoryId");
b.HasIndex("PlaidTransactionId")
.IsUnique();
b.ToTable("transaction_classifications", "app");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidAccount", b =>
{
b.HasOne("Asentrafin.Api.Entities.PlaidItem", "PlaidItem")
.WithMany("Accounts")
.HasForeignKey("PlaidItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PlaidItem");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidHolding", b =>
{
b.HasOne("Asentrafin.Api.Entities.PlaidAccount", "PlaidAccount")
.WithMany("Holdings")
.HasForeignKey("PlaidAccountId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Asentrafin.Api.Entities.PlaidItem", "PlaidItem")
.WithMany("Holdings")
.HasForeignKey("PlaidItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Asentrafin.Api.Entities.PlaidSecurity", "PlaidSecurity")
.WithMany("Holdings")
.HasForeignKey("PlaidSecurityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PlaidAccount");
b.Navigation("PlaidItem");
b.Navigation("PlaidSecurity");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidInvestmentTransaction", b =>
{
b.HasOne("Asentrafin.Api.Entities.PlaidAccount", "PlaidAccount")
.WithMany("InvestmentTransactions")
.HasForeignKey("PlaidAccountId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Asentrafin.Api.Entities.PlaidItem", "PlaidItem")
.WithMany("InvestmentTransactions")
.HasForeignKey("PlaidItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Asentrafin.Api.Entities.PlaidSecurity", "PlaidSecurity")
.WithMany("InvestmentTransactions")
.HasForeignKey("PlaidSecurityId")
.OnDelete(DeleteBehavior.SetNull);
b.Navigation("PlaidAccount");
b.Navigation("PlaidItem");
b.Navigation("PlaidSecurity");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidTransaction", b =>
{
b.HasOne("Asentrafin.Api.Entities.PlaidAccount", "PlaidAccount")
.WithMany("Transactions")
.HasForeignKey("PlaidAccountId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("Asentrafin.Api.Entities.PlaidItem", "PlaidItem")
.WithMany("Transactions")
.HasForeignKey("PlaidItemId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PlaidAccount");
b.Navigation("PlaidItem");
});
modelBuilder.Entity("Asentrafin.Api.Entities.TransactionCategory", b =>
{
b.HasOne("Asentrafin.Api.Entities.TransactionCategory", "Parent")
.WithMany("Children")
.HasForeignKey("ParentId")
.OnDelete(DeleteBehavior.Restrict);
b.Navigation("Parent");
});
modelBuilder.Entity("Asentrafin.Api.Entities.TransactionClassification", b =>
{
b.HasOne("Asentrafin.Api.Entities.TransactionCategory", "Category")
.WithMany("Classifications")
.HasForeignKey("CategoryId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.HasOne("Asentrafin.Api.Entities.PlaidTransaction", "PlaidTransaction")
.WithOne("Classification")
.HasForeignKey("Asentrafin.Api.Entities.TransactionClassification", "PlaidTransactionId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Category");
b.Navigation("PlaidTransaction");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidAccount", b =>
{
b.Navigation("Holdings");
b.Navigation("InvestmentTransactions");
b.Navigation("Transactions");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidItem", b =>
{
b.Navigation("Accounts");
b.Navigation("Holdings");
b.Navigation("InvestmentTransactions");
b.Navigation("Transactions");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidSecurity", b =>
{
b.Navigation("Holdings");
b.Navigation("InvestmentTransactions");
});
modelBuilder.Entity("Asentrafin.Api.Entities.PlaidTransaction", b =>
{
b.Navigation("Classification");
});
modelBuilder.Entity("Asentrafin.Api.Entities.TransactionCategory", b =>
{
b.Navigation("Children");
b.Navigation("Classifications");
});
#pragma warning restore 612, 618
}
}
}