using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace CompanyManagment.EFCore.Migrations { /// public partial class Addnewinstitutioncontractproperties : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "InstitutionContractWorkshopDetailEmployers"); migrationBuilder.DropTable( name: "InstitutionContractWorkshopDetail"); migrationBuilder.RenameColumn( name: "Status", table: "InstitutionContracts", newName: "VerificationStatus"); migrationBuilder.AddColumn( name: "InstitutionContractAmendmentId", table: "InstitutionContractInstallments", type: "bigint", nullable: true); migrationBuilder.CreateTable( name: "InstitutionContractAmendment", columns: table => new { id = table.Column(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), InstitutionContractId = table.Column(type: "bigint", nullable: false), Amount = table.Column(type: "float", nullable: false), HasInstallment = table.Column(type: "bit", nullable: false), CreationDate = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), InstitutionContractId = table.Column(type: "bigint", nullable: false), LastModifiedDate = table.Column(type: "datetime2", nullable: false), CreationDate = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), InstitutionContractAmendmentId = table.Column(type: "bigint", nullable: false), ChangeType = table.Column(type: "int", nullable: false), ChangeDateGr = table.Column(type: "datetime2", nullable: false), HasRollCallPlan = table.Column(type: "bit", nullable: true), HasCustomizeCheckoutPlan = table.Column(type: "bit", nullable: true), HasContractPlan = table.Column(type: "bit", nullable: true), HasContractPlanInPerson = table.Column(type: "bit", nullable: true), HasInsurancePlan = table.Column(type: "bit", nullable: true), HasInsurancePlanInPerson = table.Column(type: "bit", nullable: true), PersonnelCount = table.Column(type: "int", nullable: true), WorkshopDetailsId = table.Column(type: "bigint", nullable: true), CreationDate = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), WorkshopId = table.Column(type: "bigint", nullable: true), WorkshopName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), HasRollCallPlan = table.Column(type: "bit", nullable: false), HasCustomizeCheckoutPlan = table.Column(type: "bit", nullable: false), HasContractPlan = table.Column(type: "bit", nullable: false), HasContractPlanInPerson = table.Column(type: "bit", nullable: false), HasInsurancePlan = table.Column(type: "bit", nullable: false), HasInsurancePlanInPerson = table.Column(type: "bit", nullable: false), PersonnelCount = table.Column(type: "int", nullable: false), WorkshopCreated = table.Column(type: "bit", nullable: false), InstitutionContractId = table.Column(type: "bigint", nullable: false), InstitutionContractWorkshopGroupId = table.Column(type: "bigint", nullable: false), Price = table.Column(type: "float", nullable: false), CreationDate = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), WorkshopId = table.Column(type: "bigint", nullable: true), WorkshopName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), HasRollCallPlan = table.Column(type: "bit", nullable: false), HasCustomizeCheckoutPlan = table.Column(type: "bit", nullable: false), HasContractPlan = table.Column(type: "bit", nullable: false), HasContractPlanInPerson = table.Column(type: "bit", nullable: false), HasInsurancePlan = table.Column(type: "bit", nullable: false), HasInsurancePlanInPerson = table.Column(type: "bit", nullable: false), PersonnelCount = table.Column(type: "int", nullable: false), WorkshopCreated = table.Column(type: "bit", nullable: false), InstitutionContractId = table.Column(type: "bigint", nullable: false), InstitutionContractWorkshopGroupId = table.Column(type: "bigint", nullable: false), Price = table.Column(type: "float", nullable: false), CreationDate = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), InstitutionContractWorkshopDetailId = table.Column(type: "bigint", nullable: false), EmployerId = table.Column(type: "bigint", nullable: false), CreationDate = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), InstitutionContractWorkshopDetailId = table.Column(type: "bigint", nullable: false), EmployerId = table.Column(type: "bigint", nullable: false), CreationDate = table.Column(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"); } /// 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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), InstitutionContractId = table.Column(type: "bigint", nullable: false), CreationDate = table.Column(type: "datetime2", nullable: false), HasContractPlan = table.Column(type: "bit", nullable: false), HasContractPlanInPerson = table.Column(type: "bit", nullable: false), HasCustomizeCheckoutPlan = table.Column(type: "bit", nullable: false), HasInsurancePlan = table.Column(type: "bit", nullable: false), HasInsurancePlanInPerson = table.Column(type: "bit", nullable: false), HasRollCallPlan = table.Column(type: "bit", nullable: false), PersonnelCount = table.Column(type: "int", nullable: false), Price = table.Column(type: "float", nullable: false), WorkshopCreated = table.Column(type: "bit", nullable: false), WorkshopId = table.Column(type: "bigint", nullable: true), WorkshopName = table.Column(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(type: "bigint", nullable: false) .Annotation("SqlServer:Identity", "1, 1"), CreationDate = table.Column(type: "datetime2", nullable: false), EmployerId = table.Column(type: "bigint", nullable: false), InstitutionContractWorkshopDetailId = table.Column(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); } } }