feat(infra): add modeling to dbcontext for balance model with migrations

This commit is contained in:
Stevan Freeborn
2026-02-14 06:46:05 -06:00
parent e331030bb0
commit ed7e25961c
4 changed files with 466 additions and 4 deletions
@@ -0,0 +1,49 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace FiscalOS.Infra.Migrations
{
/// <inheritdoc />
public partial class AddBalancesWithConnectionToAccounts : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Balance",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
AccountId = table.Column<Guid>(type: "TEXT", nullable: false),
Current = table.Column<decimal>(type: "TEXT", nullable: false),
Available = table.Column<decimal>(type: "TEXT", nullable: false),
CreatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false),
UpdatedAt = table.Column<DateTimeOffset>(type: "TEXT", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Balance", x => x.Id);
table.ForeignKey(
name: "FK_Balance_Account_AccountId",
column: x => x.AccountId,
principalTable: "Account",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Balance_AccountId",
table: "Balance",
column: "AccountId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Balance");
}
}
}