domBudg/back/Infrastructure/Migrations/20241126222847_AddSpendingPlan.cs

49 lines
1.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddSpendingPlan : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SpendingPlans",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
StartAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
EndAt = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
Sum = table.Column<decimal>(type: "numeric", nullable: false),
SpendingGroupId = table.Column<Guid>(type: "uuid", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SpendingPlans", x => x.Id);
table.ForeignKey(
name: "FK_SpendingPlans_SpendingGroups_SpendingGroupId",
column: x => x.SpendingGroupId,
principalTable: "SpendingGroups",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_SpendingPlans_SpendingGroupId",
table: "SpendingPlans",
column: "SpendingGroupId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SpendingPlans");
}
}
}