123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- 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<string>(
- name: "Video",
- table: "Properties",
- nullable: true);
-
- migrationBuilder.AddColumn<string>(
- name: "VirtualTour",
- table: "Properties",
- nullable: true);
-
- migrationBuilder.AddColumn<int>(
- name: "BankAccountId",
- table: "Individuals",
- nullable: true);
-
- migrationBuilder.AlterColumn<int>(
- name: "BankId",
- table: "BankAccounts",
- nullable: true,
- oldClrType: typeof(int));
-
- migrationBuilder.AddColumn<int>(
- 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<int>(
- 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);
- }
- }
- }
|