using Microsoft.EntityFrameworkCore.Migrations; namespace UnivateProperties_API.Migrations { public partial class MappingBank : Migration { protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_BankAccounts_Banks_BankId", table: "BankAccounts"); migrationBuilder.AddColumn( name: "Video", table: "Properties", nullable: true); migrationBuilder.AddColumn( name: "VirtualTour", table: "Properties", nullable: true); migrationBuilder.AddColumn( name: "BankAccountId", table: "Individuals", nullable: true); migrationBuilder.AlterColumn( name: "BankId", table: "BankAccounts", nullable: true, oldClrType: typeof(int)); migrationBuilder.AddColumn( name: "OwnerId", table: "Addresses", nullable: true); migrationBuilder.CreateIndex( name: "IX_Individuals_BankAccountId", table: "Individuals", column: "BankAccountId"); migrationBuilder.CreateIndex( name: "IX_Addresses_OwnerId", table: "Addresses", column: "OwnerId"); migrationBuilder.AddForeignKey( name: "FK_Addresses_Individuals_OwnerId", table: "Addresses", column: "OwnerId", principalTable: "Individuals", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_BankAccounts_Banks_BankId", table: "BankAccounts", column: "BankId", principalTable: "Banks", principalColumn: "Id", onDelete: ReferentialAction.Restrict); migrationBuilder.AddForeignKey( name: "FK_Individuals_BankAccounts_BankAccountId", table: "Individuals", column: "BankAccountId", principalTable: "BankAccounts", principalColumn: "Id", onDelete: ReferentialAction.Restrict); } protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Addresses_Individuals_OwnerId", table: "Addresses"); migrationBuilder.DropForeignKey( name: "FK_BankAccounts_Banks_BankId", table: "BankAccounts"); migrationBuilder.DropForeignKey( name: "FK_Individuals_BankAccounts_BankAccountId", table: "Individuals"); migrationBuilder.DropIndex( name: "IX_Individuals_BankAccountId", table: "Individuals"); migrationBuilder.DropIndex( name: "IX_Addresses_OwnerId", table: "Addresses"); migrationBuilder.DropColumn( name: "Video", table: "Properties"); migrationBuilder.DropColumn( name: "VirtualTour", table: "Properties"); migrationBuilder.DropColumn( name: "BankAccountId", table: "Individuals"); migrationBuilder.DropColumn( name: "OwnerId", table: "Addresses"); migrationBuilder.AlterColumn( name: "BankId", table: "BankAccounts", nullable: false, oldClrType: typeof(int), oldNullable: true); migrationBuilder.AddForeignKey( name: "FK_BankAccounts_Banks_BankId", table: "BankAccounts", column: "BankId", principalTable: "Banks", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }