Rename to reflect multi-provider support (OpenAI + Anthropic): - Rename Services/OpenAIReceiptParser.cs to Services/AIReceiptParser.cs - Update class name from OpenAIReceiptParser to AIReceiptParser - Update DI registration in Program.cs The parser now supports both OpenAI and Anthropic models, so the more generic name better reflects its capabilities. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
185 lines
7.3 KiB
C#
185 lines
7.3 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace MoneyMap.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class SplitCardsAndAccounts : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Transactions_Date_Amount_Name_Memo_CardId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "CardLast4",
|
|
table: "Transactions",
|
|
newName: "Last4");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "CardId",
|
|
table: "Transactions",
|
|
type: "int",
|
|
nullable: true,
|
|
oldClrType: typeof(int),
|
|
oldType: "int");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "AccountId",
|
|
table: "Transactions",
|
|
type: "int",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Accounts",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<int>(type: "int", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Institution = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
Last4 = table.Column<string>(type: "nvarchar(4)", maxLength: 4, nullable: false),
|
|
Owner = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: false),
|
|
AccountType = table.Column<int>(type: "int", nullable: false),
|
|
Nickname = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Accounts", x => x.Id);
|
|
});
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "Transfers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<long>(type: "bigint", nullable: false)
|
|
.Annotation("SqlServer:Identity", "1, 1"),
|
|
Date = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Amount = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
|
Description = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: false),
|
|
Notes = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
|
SourceAccountId = table.Column<int>(type: "int", nullable: true),
|
|
DestinationAccountId = table.Column<int>(type: "int", nullable: true),
|
|
OriginalTransactionId = table.Column<long>(type: "bigint", nullable: true),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_Transfers", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_Transfers_Accounts_DestinationAccountId",
|
|
column: x => x.DestinationAccountId,
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Transfers_Accounts_SourceAccountId",
|
|
column: x => x.SourceAccountId,
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
table.ForeignKey(
|
|
name: "FK_Transfers_Transactions_OriginalTransactionId",
|
|
column: x => x.OriginalTransactionId,
|
|
principalTable: "Transactions",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.SetNull);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transactions_AccountId",
|
|
table: "Transactions",
|
|
column: "AccountId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transactions_Date_Amount_Name_Memo_CardId_AccountId",
|
|
table: "Transactions",
|
|
columns: new[] { "Date", "Amount", "Name", "Memo", "CardId", "AccountId" },
|
|
unique: true,
|
|
filter: "[CardId] IS NOT NULL AND [AccountId] IS NOT NULL");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Accounts_Institution_Last4_Owner",
|
|
table: "Accounts",
|
|
columns: new[] { "Institution", "Last4", "Owner" });
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transfers_Date",
|
|
table: "Transfers",
|
|
column: "Date");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transfers_DestinationAccountId",
|
|
table: "Transfers",
|
|
column: "DestinationAccountId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transfers_OriginalTransactionId",
|
|
table: "Transfers",
|
|
column: "OriginalTransactionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transfers_SourceAccountId",
|
|
table: "Transfers",
|
|
column: "SourceAccountId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Accounts_AccountId",
|
|
table: "Transactions",
|
|
column: "AccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Restrict);
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Accounts_AccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Transfers");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "Accounts");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Transactions_AccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_Transactions_Date_Amount_Name_Memo_CardId_AccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "AccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.RenameColumn(
|
|
name: "Last4",
|
|
table: "Transactions",
|
|
newName: "CardLast4");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "CardId",
|
|
table: "Transactions",
|
|
type: "int",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "int",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_Transactions_Date_Amount_Name_Memo_CardId",
|
|
table: "Transactions",
|
|
columns: new[] { "Date", "Amount", "Name", "Memo", "CardId" },
|
|
unique: true);
|
|
}
|
|
}
|
|
}
|