Files
Backend-Api/CompanyManagment.EFCore/Migrations/20250920130310_Add new institution contract properties.cs

367 lines
20 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class Addnewinstitutioncontractproperties : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InstitutionContractWorkshopDetailEmployers");
migrationBuilder.DropTable(
name: "InstitutionContractWorkshopDetail");
migrationBuilder.RenameColumn(
name: "Status",
table: "InstitutionContracts",
newName: "VerificationStatus");
migrationBuilder.AddColumn<long>(
name: "InstitutionContractAmendmentId",
table: "InstitutionContractInstallments",
type: "bigint",
nullable: true);
migrationBuilder.CreateTable(
name: "InstitutionContractAmendment",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
Amount = table.Column<double>(type: "float", nullable: false),
HasInstallment = table.Column<bool>(type: "bit", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractAmendment", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractAmendment_InstitutionContracts_InstitutionContractId",
column: x => x.InstitutionContractId,
principalTable: "InstitutionContracts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractWorkshopGroup",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
LastModifiedDate = table.Column<DateTime>(type: "datetime2", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractWorkshopGroup", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractWorkshopGroup_InstitutionContracts_InstitutionContractId",
column: x => x.InstitutionContractId,
principalTable: "InstitutionContracts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractAmendmentChange",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstitutionContractAmendmentId = table.Column<long>(type: "bigint", nullable: false),
ChangeType = table.Column<int>(type: "int", nullable: false),
ChangeDateGr = table.Column<DateTime>(type: "datetime2", nullable: false),
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: true),
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: true),
HasContractPlan = table.Column<bool>(type: "bit", nullable: true),
HasContractPlanInPerson = table.Column<bool>(type: "bit", nullable: true),
HasInsurancePlan = table.Column<bool>(type: "bit", nullable: true),
HasInsurancePlanInPerson = table.Column<bool>(type: "bit", nullable: true),
PersonnelCount = table.Column<int>(type: "int", nullable: true),
WorkshopDetailsId = table.Column<long>(type: "bigint", nullable: true),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractAmendmentChange", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractAmendmentChange_InstitutionContractAmendment_InstitutionContractAmendmentId",
column: x => x.InstitutionContractAmendmentId,
principalTable: "InstitutionContractAmendment",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractCurrentWorkshopDetails",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkshopId = table.Column<long>(type: "bigint", nullable: true),
WorkshopName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: false),
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: false),
HasContractPlan = table.Column<bool>(type: "bit", nullable: false),
HasContractPlanInPerson = table.Column<bool>(type: "bit", nullable: false),
HasInsurancePlan = table.Column<bool>(type: "bit", nullable: false),
HasInsurancePlanInPerson = table.Column<bool>(type: "bit", nullable: false),
PersonnelCount = table.Column<int>(type: "int", nullable: false),
WorkshopCreated = table.Column<bool>(type: "bit", nullable: false),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
InstitutionContractWorkshopGroupId = table.Column<long>(type: "bigint", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractCurrentWorkshopDetails", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractCurrentWorkshopDetails_InstitutionContractWorkshopGroup_InstitutionContractWorkshopGroupId",
column: x => x.InstitutionContractWorkshopGroupId,
principalTable: "InstitutionContractWorkshopGroup",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractInitialWorkshopDetails",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
WorkshopId = table.Column<long>(type: "bigint", nullable: true),
WorkshopName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true),
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: false),
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: false),
HasContractPlan = table.Column<bool>(type: "bit", nullable: false),
HasContractPlanInPerson = table.Column<bool>(type: "bit", nullable: false),
HasInsurancePlan = table.Column<bool>(type: "bit", nullable: false),
HasInsurancePlanInPerson = table.Column<bool>(type: "bit", nullable: false),
PersonnelCount = table.Column<int>(type: "int", nullable: false),
WorkshopCreated = table.Column<bool>(type: "bit", nullable: false),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
InstitutionContractWorkshopGroupId = table.Column<long>(type: "bigint", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractInitialWorkshopDetails", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractInitialWorkshopDetails_InstitutionContractWorkshopGroup_InstitutionContractWorkshopGroupId",
column: x => x.InstitutionContractWorkshopGroupId,
principalTable: "InstitutionContractWorkshopGroup",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractCurrentWorkshopDetailEmployers",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstitutionContractWorkshopDetailId = table.Column<long>(type: "bigint", nullable: false),
EmployerId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractCurrentWorkshopDetailEmployers", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractCurrentWorkshopDetailEmployers_InstitutionContractCurrentWorkshopDetails_InstitutionContractWorkshopDetai~",
column: x => x.InstitutionContractWorkshopDetailId,
principalTable: "InstitutionContractCurrentWorkshopDetails",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractInitialWorkshopDetailEmployers",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstitutionContractWorkshopDetailId = table.Column<long>(type: "bigint", nullable: false),
EmployerId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractInitialWorkshopDetailEmployers", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractInitialWorkshopDetailEmployers_InstitutionContractInitialWorkshopDetails_InstitutionContractWorkshopDetai~",
column: x => x.InstitutionContractWorkshopDetailId,
principalTable: "InstitutionContractInitialWorkshopDetails",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractInstallments_InstitutionContractAmendmentId",
table: "InstitutionContractInstallments",
column: "InstitutionContractAmendmentId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractAmendment_InstitutionContractId",
table: "InstitutionContractAmendment",
column: "InstitutionContractId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractAmendmentChange_InstitutionContractAmendmentId",
table: "InstitutionContractAmendmentChange",
column: "InstitutionContractAmendmentId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractCurrentWorkshopDetailEmployers_InstitutionContractWorkshopDetailId_EmployerId",
table: "InstitutionContractCurrentWorkshopDetailEmployers",
columns: new[] { "InstitutionContractWorkshopDetailId", "EmployerId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractCurrentWorkshopDetails_InstitutionContractWorkshopGroupId",
table: "InstitutionContractCurrentWorkshopDetails",
column: "InstitutionContractWorkshopGroupId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractInitialWorkshopDetailEmployers_InstitutionContractWorkshopDetailId_EmployerId",
table: "InstitutionContractInitialWorkshopDetailEmployers",
columns: new[] { "InstitutionContractWorkshopDetailId", "EmployerId" },
unique: true);
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractInitialWorkshopDetails_InstitutionContractWorkshopGroupId",
table: "InstitutionContractInitialWorkshopDetails",
column: "InstitutionContractWorkshopGroupId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractWorkshopGroup_InstitutionContractId",
table: "InstitutionContractWorkshopGroup",
column: "InstitutionContractId",
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_InstitutionContractInstallments_InstitutionContractAmendment_InstitutionContractAmendmentId",
table: "InstitutionContractInstallments",
column: "InstitutionContractAmendmentId",
principalTable: "InstitutionContractAmendment",
principalColumn: "id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InstitutionContractInstallments_InstitutionContractAmendment_InstitutionContractAmendmentId",
table: "InstitutionContractInstallments");
migrationBuilder.DropTable(
name: "InstitutionContractAmendmentChange");
migrationBuilder.DropTable(
name: "InstitutionContractCurrentWorkshopDetailEmployers");
migrationBuilder.DropTable(
name: "InstitutionContractInitialWorkshopDetailEmployers");
migrationBuilder.DropTable(
name: "InstitutionContractAmendment");
migrationBuilder.DropTable(
name: "InstitutionContractCurrentWorkshopDetails");
migrationBuilder.DropTable(
name: "InstitutionContractInitialWorkshopDetails");
migrationBuilder.DropTable(
name: "InstitutionContractWorkshopGroup");
migrationBuilder.DropIndex(
name: "IX_InstitutionContractInstallments_InstitutionContractAmendmentId",
table: "InstitutionContractInstallments");
migrationBuilder.DropColumn(
name: "InstitutionContractAmendmentId",
table: "InstitutionContractInstallments");
migrationBuilder.RenameColumn(
name: "VerificationStatus",
table: "InstitutionContracts",
newName: "Status");
migrationBuilder.CreateTable(
name: "InstitutionContractWorkshopDetail",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
InstitutionContractId = table.Column<long>(type: "bigint", nullable: false),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
HasContractPlan = table.Column<bool>(type: "bit", nullable: false),
HasContractPlanInPerson = table.Column<bool>(type: "bit", nullable: false),
HasCustomizeCheckoutPlan = table.Column<bool>(type: "bit", nullable: false),
HasInsurancePlan = table.Column<bool>(type: "bit", nullable: false),
HasInsurancePlanInPerson = table.Column<bool>(type: "bit", nullable: false),
HasRollCallPlan = table.Column<bool>(type: "bit", nullable: false),
PersonnelCount = table.Column<int>(type: "int", nullable: false),
Price = table.Column<double>(type: "float", nullable: false),
WorkshopCreated = table.Column<bool>(type: "bit", nullable: false),
WorkshopId = table.Column<long>(type: "bigint", nullable: true),
WorkshopName = table.Column<string>(type: "nvarchar(100)", maxLength: 100, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractWorkshopDetail", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractWorkshopDetail_InstitutionContracts_InstitutionContractId",
column: x => x.InstitutionContractId,
principalTable: "InstitutionContracts",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "InstitutionContractWorkshopDetailEmployers",
columns: table => new
{
id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CreationDate = table.Column<DateTime>(type: "datetime2", nullable: false),
EmployerId = table.Column<long>(type: "bigint", nullable: false),
InstitutionContractWorkshopDetailId = table.Column<long>(type: "bigint", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstitutionContractWorkshopDetailEmployers", x => x.id);
table.ForeignKey(
name: "FK_InstitutionContractWorkshopDetailEmployers_InstitutionContractWorkshopDetail_InstitutionContractWorkshopDetailId",
column: x => x.InstitutionContractWorkshopDetailId,
principalTable: "InstitutionContractWorkshopDetail",
principalColumn: "id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractWorkshopDetail_InstitutionContractId",
table: "InstitutionContractWorkshopDetail",
column: "InstitutionContractId");
migrationBuilder.CreateIndex(
name: "IX_InstitutionContractWorkshopDetailEmployers_InstitutionContractWorkshopDetailId_EmployerId",
table: "InstitutionContractWorkshopDetailEmployers",
columns: new[] { "InstitutionContractWorkshopDetailId", "EmployerId" },
unique: true);
}
}
}