CourseWork_Bank/Bank/BankDatabaseImplement/Migrations/20230516175437_NewSmallFix.cs
2024-05-28 16:35:25 +04:00

104 lines
3.3 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BankDatabaseImplement.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);
}
}
}