50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
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");
|
|
}
|
|
}
|
|
}
|