using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace AAIntegration.SimmonsBank.API.Migrations { /// public partial class removedOwner : Migration { /// protected override void Up(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"); migrationBuilder.AddColumn( name: "UserId", table: "Accounts", type: "integer", nullable: true); migrationBuilder.CreateIndex( name: "IX_Accounts_UserId", table: "Accounts", column: "UserId"); migrationBuilder.AddForeignKey( name: "FK_Accounts_Users_UserId", table: "Accounts", column: "UserId", principalTable: "Users", principalColumn: "Id"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Accounts_Users_UserId", table: "Accounts"); migrationBuilder.DropIndex( name: "IX_Accounts_UserId", table: "Accounts"); migrationBuilder.DropColumn( name: "UserId", table: "Accounts"); 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); } } }