Files
Backend-Api/CompanyManagment.EFCore/Migrations/20240221002911_ContractingParyAcc.cs
2024-07-05 21:36:15 +03:30

108 lines
4.1 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class ContractingParyAcc : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ContractingPartyAccount_PersonalContractingParties_PersonalContractingPartyid",
table: "ContractingPartyAccount");
migrationBuilder.DropPrimaryKey(
name: "PK_ContractingPartyAccount",
table: "ContractingPartyAccount");
migrationBuilder.DropIndex(
name: "IX_ContractingPartyAccount_PersonalContractingPartyid",
table: "ContractingPartyAccount");
migrationBuilder.DropColumn(
name: "ContractingPartyId",
table: "ContractingPartyAccount");
migrationBuilder.RenameColumn(
name: "PersonalContractingPartyid",
table: "ContractingPartyAccount",
newName: "PersonalContractingPartyId");
migrationBuilder.AlterColumn<long>(
name: "PersonalContractingPartyId",
table: "ContractingPartyAccount",
type: "bigint",
nullable: false,
defaultValue: 0L,
oldClrType: typeof(long),
oldType: "bigint",
oldNullable: true);
migrationBuilder.AddPrimaryKey(
name: "PK_ContractingPartyAccount",
table: "ContractingPartyAccount",
columns: new[] { "PersonalContractingPartyId", "AccountId" });
migrationBuilder.AddForeignKey(
name: "FK_ContractingPartyAccount_PersonalContractingParties_PersonalContractingPartyId",
table: "ContractingPartyAccount",
column: "PersonalContractingPartyId",
principalTable: "PersonalContractingParties",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_ContractingPartyAccount_PersonalContractingParties_PersonalContractingPartyId",
table: "ContractingPartyAccount");
migrationBuilder.DropPrimaryKey(
name: "PK_ContractingPartyAccount",
table: "ContractingPartyAccount");
migrationBuilder.RenameColumn(
name: "PersonalContractingPartyId",
table: "ContractingPartyAccount",
newName: "PersonalContractingPartyid");
migrationBuilder.AlterColumn<long>(
name: "PersonalContractingPartyid",
table: "ContractingPartyAccount",
type: "bigint",
nullable: true,
oldClrType: typeof(long),
oldType: "bigint");
migrationBuilder.AddColumn<long>(
name: "ContractingPartyId",
table: "ContractingPartyAccount",
type: "bigint",
nullable: false,
defaultValue: 0L);
migrationBuilder.AddPrimaryKey(
name: "PK_ContractingPartyAccount",
table: "ContractingPartyAccount",
columns: new[] { "ContractingPartyId", "AccountId" });
migrationBuilder.CreateIndex(
name: "IX_ContractingPartyAccount_PersonalContractingPartyid",
table: "ContractingPartyAccount",
column: "PersonalContractingPartyid");
migrationBuilder.AddForeignKey(
name: "FK_ContractingPartyAccount_PersonalContractingParties_PersonalContractingPartyid",
table: "ContractingPartyAccount",
column: "PersonalContractingPartyid",
principalTable: "PersonalContractingParties",
principalColumn: "id");
}
}
}