374 lines
13 KiB
C#
374 lines
13 KiB
C#
// <auto-generated />
|
|
using System;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Metadata;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
using MoneyMap.Data;
|
|
|
|
#nullable disable
|
|
|
|
namespace MoneyMap.Migrations
|
|
{
|
|
[DbContext(typeof(MoneyMapContext))]
|
|
[Migration("20251004023633_AddCategoryMappings")]
|
|
partial class AddCategoryMappings
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
{
|
|
#pragma warning disable 612, 618
|
|
modelBuilder
|
|
.HasAnnotation("ProductVersion", "9.0.9")
|
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
|
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Card", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Issuer")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Last4")
|
|
.IsRequired()
|
|
.HasMaxLength(4)
|
|
.HasColumnType("nvarchar(4)");
|
|
|
|
b.Property<string>("Owner")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Issuer", "Last4", "Owner");
|
|
|
|
b.ToTable("Cards");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Receipt", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<string>("ContentType")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)")
|
|
.HasDefaultValue("application/octet-stream");
|
|
|
|
b.Property<string>("Currency")
|
|
.HasMaxLength(8)
|
|
.HasColumnType("nvarchar(8)");
|
|
|
|
b.Property<string>("FileHashSha256")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.HasColumnType("nvarchar(64)");
|
|
|
|
b.Property<string>("FileName")
|
|
.IsRequired()
|
|
.HasMaxLength(260)
|
|
.HasColumnType("nvarchar(260)");
|
|
|
|
b.Property<long>("FileSizeBytes")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<string>("Merchant")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<DateTime?>("ReceiptDate")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("StoragePath")
|
|
.IsRequired()
|
|
.HasMaxLength(1024)
|
|
.HasColumnType("nvarchar(1024)");
|
|
|
|
b.Property<decimal?>("Subtotal")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal?>("Tax")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal?>("Total")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<long>("TransactionId")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("UploadedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("TransactionId", "FileHashSha256")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Receipts");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.ReceiptLineItem", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<string>("Category")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Description")
|
|
.IsRequired()
|
|
.HasMaxLength(300)
|
|
.HasColumnType("nvarchar(300)");
|
|
|
|
b.Property<int>("LineNumber")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<decimal?>("LineTotal")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<decimal?>("Quantity")
|
|
.HasColumnType("decimal(18,4)");
|
|
|
|
b.Property<long>("ReceiptId")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<string>("Sku")
|
|
.HasMaxLength(64)
|
|
.HasColumnType("nvarchar(64)");
|
|
|
|
b.Property<string>("Unit")
|
|
.HasMaxLength(16)
|
|
.HasColumnType("nvarchar(16)");
|
|
|
|
b.Property<decimal?>("UnitPrice")
|
|
.HasColumnType("decimal(18,4)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ReceiptId", "LineNumber");
|
|
|
|
b.ToTable("ReceiptLineItems");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.ReceiptParseLog", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<DateTime?>("CompletedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<decimal?>("Confidence")
|
|
.HasColumnType("decimal(5,4)");
|
|
|
|
b.Property<string>("Error")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("ExtractedTextPath")
|
|
.HasMaxLength(1024)
|
|
.HasColumnType("nvarchar(1024)");
|
|
|
|
b.Property<string>("Model")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Provider")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<string>("ProviderJobId")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("RawProviderPayloadJson")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<long>("ReceiptId")
|
|
.HasColumnType("bigint");
|
|
|
|
b.Property<DateTime>("StartedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<bool>("Success")
|
|
.HasColumnType("bit");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ReceiptId", "StartedAtUtc");
|
|
|
|
b.ToTable("ReceiptParseLogs");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Transaction", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<decimal>("Amount")
|
|
.HasColumnType("decimal(18,2)");
|
|
|
|
b.Property<int>("CardId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("CardLast4")
|
|
.HasMaxLength(4)
|
|
.HasColumnType("nvarchar(4)");
|
|
|
|
b.Property<string>("Category")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<DateTime>("Date")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Memo")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAdd()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)")
|
|
.HasDefaultValue("");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("TransactionType")
|
|
.IsRequired()
|
|
.HasMaxLength(20)
|
|
.HasColumnType("nvarchar(20)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Amount");
|
|
|
|
b.HasIndex("CardId");
|
|
|
|
b.HasIndex("Category");
|
|
|
|
b.HasIndex("Date");
|
|
|
|
b.HasIndex("Date", "Amount", "Name", "Memo", "CardId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Transactions");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Services.CategoryMapping", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Category")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("Pattern")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("Priority")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("CategoryMappings");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Receipt", b =>
|
|
{
|
|
b.HasOne("MoneyMap.Models.Transaction", "Transaction")
|
|
.WithMany("Receipts")
|
|
.HasForeignKey("TransactionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Transaction");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.ReceiptLineItem", b =>
|
|
{
|
|
b.HasOne("MoneyMap.Models.Receipt", "Receipt")
|
|
.WithMany("LineItems")
|
|
.HasForeignKey("ReceiptId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Receipt");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.ReceiptParseLog", b =>
|
|
{
|
|
b.HasOne("MoneyMap.Models.Receipt", "Receipt")
|
|
.WithMany("ParseLogs")
|
|
.HasForeignKey("ReceiptId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Receipt");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Transaction", b =>
|
|
{
|
|
b.HasOne("MoneyMap.Models.Card", "Card")
|
|
.WithMany("Transactions")
|
|
.HasForeignKey("CardId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.Navigation("Card");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Card", b =>
|
|
{
|
|
b.Navigation("Transactions");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Receipt", b =>
|
|
{
|
|
b.Navigation("LineItems");
|
|
|
|
b.Navigation("ParseLogs");
|
|
});
|
|
|
|
modelBuilder.Entity("MoneyMap.Models.Transaction", b =>
|
|
{
|
|
b.Navigation("Receipts");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|