using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Infrastructure.Migrations { /// public partial class AddChangeRecord : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "ChangeRecords", columns: table => new { Id = table.Column(type: "uuid", nullable: false), Sum = table.Column(type: "numeric", nullable: false), ChangedAt = table.Column(type: "timestamp with time zone", nullable: false), UserId = table.Column(type: "uuid", nullable: false), SpendingGroupId = table.Column(type: "uuid", nullable: false) }, constraints: table => { table.PrimaryKey("PK_ChangeRecords", x => x.Id); table.ForeignKey( name: "FK_ChangeRecords_SpendingGroups_SpendingGroupId", column: x => x.SpendingGroupId, principalTable: "SpendingGroups", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_ChangeRecords_Users_UserId", column: x => x.UserId, principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_ChangeRecords_SpendingGroupId", table: "ChangeRecords", column: "SpendingGroupId"); migrationBuilder.CreateIndex( name: "IX_ChangeRecords_UserId", table: "ChangeRecords", column: "UserId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "ChangeRecords"); } } }