using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace AAIntegration.SimmonsBank.API.Migrations { /// public partial class UserOwnedEntities : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "OwnerId", table: "Transactions", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.AddColumn( name: "OwnerId", table: "Accounts", type: "integer", nullable: false, defaultValue: 0); migrationBuilder.CreateIndex( name: "IX_Transactions_OwnerId", table: "Transactions", column: "OwnerId"); migrationBuilder.CreateIndex( name: "IX_Accounts_OwnerId", table: "Accounts", column: "OwnerId"); migrationBuilder.AddForeignKey( name: "FK_Accounts_Users_OwnerId", table: "Accounts", column: "OwnerId", principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); migrationBuilder.AddForeignKey( name: "FK_Transactions_Users_OwnerId", table: "Transactions", column: "OwnerId", principalTable: "Users", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Accounts_Users_OwnerId", table: "Accounts"); migrationBuilder.DropForeignKey( name: "FK_Transactions_Users_OwnerId", table: "Transactions"); migrationBuilder.DropIndex( name: "IX_Transactions_OwnerId", table: "Transactions"); migrationBuilder.DropIndex( name: "IX_Accounts_OwnerId", table: "Accounts"); migrationBuilder.DropColumn( name: "OwnerId", table: "Transactions"); migrationBuilder.DropColumn( name: "OwnerId", table: "Accounts"); } } }