171 lines
6.0 KiB
C#
171 lines
6.0 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace AAIntegration.SimmonsBank.API.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddedEnvelopetoTransaction : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Accounts_CreditAccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Accounts_DebitAccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "DebitEnvelopeId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "DebitAccountId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: true,
|
|
oldClrType: typeof(int),
|
|
oldType: "integer");
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "CreditEnvelopeId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: true);
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "CreditAccountId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: true,
|
|
oldClrType: typeof(int),
|
|
oldType: "integer");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Accounts_CreditAccountId",
|
|
table: "Transactions",
|
|
column: "CreditAccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Accounts_DebitAccountId",
|
|
table: "Transactions",
|
|
column: "DebitAccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Envelopes_CreditEnvelopeId",
|
|
table: "Transactions",
|
|
column: "CreditEnvelopeId",
|
|
principalTable: "Envelopes",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Envelopes_DebitEnvelopeId",
|
|
table: "Transactions",
|
|
column: "DebitEnvelopeId",
|
|
principalTable: "Envelopes",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Accounts_CreditAccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Accounts_DebitAccountId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Envelopes_CreditEnvelopeId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_Transactions_Envelopes_DebitEnvelopeId",
|
|
table: "Transactions");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "DebitEnvelopeId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "integer",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "DebitAccountId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "integer",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "CreditEnvelopeId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "integer",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "CreditAccountId",
|
|
table: "Transactions",
|
|
type: "integer",
|
|
nullable: false,
|
|
defaultValue: 0,
|
|
oldClrType: typeof(int),
|
|
oldType: "integer",
|
|
oldNullable: true);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Accounts_CreditAccountId",
|
|
table: "Transactions",
|
|
column: "CreditAccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Accounts_DebitAccountId",
|
|
table: "Transactions",
|
|
column: "DebitAccountId",
|
|
principalTable: "Accounts",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Envelopes_CreditEnvelopeId",
|
|
table: "Transactions",
|
|
column: "CreditEnvelopeId",
|
|
principalTable: "Envelopes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_Transactions_Envelopes_DebitEnvelopeId",
|
|
table: "Transactions",
|
|
column: "DebitEnvelopeId",
|
|
principalTable: "Envelopes",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
}
|
|
}
|
|
}
|