using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations { /// public partial class AddSpendingPlan : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "SpendingPlans", columns: table => new { Id = table.Column(type: "uuid", nullable: false), StartAt = table.Column(type: "timestamp with time zone", nullable: false), EndAt = table.Column(type: "timestamp with time zone", nullable: false), Sum = table.Column(type: "numeric", nullable: false), SpendingGroupId = table.Column(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"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "SpendingPlans"); } } }