using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BankYouBankruptDatabaseImplement.Migrations
{
    /// <inheritdoc />
    public partial class NewSmallFix : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MoneyTransfers_Accounts_AccountSenderId",
                table: "MoneyTransfers");

            migrationBuilder.DropForeignKey(
                name: "FK_MoneyTransfers_Creditings_CreditingId",
                table: "MoneyTransfers");

            migrationBuilder.AlterColumn<int>(
                name: "CreditingId",
                table: "MoneyTransfers",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AlterColumn<int>(
                name: "AccountSenderId",
                table: "MoneyTransfers",
                type: "int",
                nullable: true,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.AddForeignKey(
                name: "FK_MoneyTransfers_Accounts_AccountSenderId",
                table: "MoneyTransfers",
                column: "AccountSenderId",
                principalTable: "Accounts",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_MoneyTransfers_Creditings_CreditingId",
                table: "MoneyTransfers",
                column: "CreditingId",
                principalTable: "Creditings",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MoneyTransfers_Accounts_AccountSenderId",
                table: "MoneyTransfers");

            migrationBuilder.DropForeignKey(
                name: "FK_MoneyTransfers_Creditings_CreditingId",
                table: "MoneyTransfers");

            migrationBuilder.AlterColumn<int>(
                name: "CreditingId",
                table: "MoneyTransfers",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AlterColumn<int>(
                name: "AccountSenderId",
                table: "MoneyTransfers",
                type: "int",
                nullable: false,
                defaultValue: 0,
                oldClrType: typeof(int),
                oldType: "int",
                oldNullable: true);

            migrationBuilder.AddForeignKey(
                name: "FK_MoneyTransfers_Accounts_AccountSenderId",
                table: "MoneyTransfers",
                column: "AccountSenderId",
                principalTable: "Accounts",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_MoneyTransfers_Creditings_CreditingId",
                table: "MoneyTransfers",
                column: "CreditingId",
                principalTable: "Creditings",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}