hrms-api-exam/Migrations/20230407090137_Add table agency.cs

242 lines
8.3 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recurit.Exam.Service.Migrations
{
/// <inheritdoc />
public partial class Addtableagency : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CMSAgency_CMSCandidates_CMSCandidateId",
table: "CMSAgency");
migrationBuilder.DropForeignKey(
name: "FK_CMSAgency_Candidates_CandidateId",
table: "CMSAgency");
migrationBuilder.DropForeignKey(
name: "FK_CMSGovernment_CMSCandidates_CMSCandidateId",
table: "CMSGovernment");
migrationBuilder.DropForeignKey(
name: "FK_CMSGovernment_Candidates_CandidateId",
table: "CMSGovernment");
migrationBuilder.DropPrimaryKey(
name: "PK_CMSGovernment",
table: "CMSGovernment");
migrationBuilder.DropPrimaryKey(
name: "PK_CMSAgency",
table: "CMSAgency");
migrationBuilder.RenameTable(
name: "CMSGovernment",
newName: "CMSGovernments");
migrationBuilder.RenameTable(
name: "CMSAgency",
newName: "CMSAgencys");
migrationBuilder.RenameColumn(
name: "ZipCode",
table: "CMSGovernments",
newName: "Name");
migrationBuilder.RenameColumn(
name: "Telephone",
table: "CMSGovernments",
newName: "Link");
migrationBuilder.RenameIndex(
name: "IX_CMSGovernment_CMSCandidateId",
table: "CMSGovernments",
newName: "IX_CMSGovernments_CMSCandidateId");
migrationBuilder.RenameIndex(
name: "IX_CMSGovernment_CandidateId",
table: "CMSGovernments",
newName: "IX_CMSGovernments_CandidateId");
migrationBuilder.RenameColumn(
name: "ZipCode",
table: "CMSAgencys",
newName: "Name");
migrationBuilder.RenameColumn(
name: "Telephone",
table: "CMSAgencys",
newName: "Link");
migrationBuilder.RenameIndex(
name: "IX_CMSAgency_CMSCandidateId",
table: "CMSAgencys",
newName: "IX_CMSAgencys_CMSCandidateId");
migrationBuilder.RenameIndex(
name: "IX_CMSAgency_CandidateId",
table: "CMSAgencys",
newName: "IX_CMSAgencys_CandidateId");
migrationBuilder.AddPrimaryKey(
name: "PK_CMSGovernments",
table: "CMSGovernments",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CMSAgencys",
table: "CMSAgencys",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
table: "CMSAgencys",
column: "CMSCandidateId",
principalTable: "CMSCandidates",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CMSAgencys_Candidates_CandidateId",
table: "CMSAgencys",
column: "CandidateId",
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
table: "CMSGovernments",
column: "CMSCandidateId",
principalTable: "CMSCandidates",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CMSGovernments_Candidates_CandidateId",
table: "CMSGovernments",
column: "CandidateId",
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_CMSAgencys_CMSCandidates_CMSCandidateId",
table: "CMSAgencys");
migrationBuilder.DropForeignKey(
name: "FK_CMSAgencys_Candidates_CandidateId",
table: "CMSAgencys");
migrationBuilder.DropForeignKey(
name: "FK_CMSGovernments_CMSCandidates_CMSCandidateId",
table: "CMSGovernments");
migrationBuilder.DropForeignKey(
name: "FK_CMSGovernments_Candidates_CandidateId",
table: "CMSGovernments");
migrationBuilder.DropPrimaryKey(
name: "PK_CMSGovernments",
table: "CMSGovernments");
migrationBuilder.DropPrimaryKey(
name: "PK_CMSAgencys",
table: "CMSAgencys");
migrationBuilder.RenameTable(
name: "CMSGovernments",
newName: "CMSGovernment");
migrationBuilder.RenameTable(
name: "CMSAgencys",
newName: "CMSAgency");
migrationBuilder.RenameColumn(
name: "Name",
table: "CMSGovernment",
newName: "ZipCode");
migrationBuilder.RenameColumn(
name: "Link",
table: "CMSGovernment",
newName: "Telephone");
migrationBuilder.RenameIndex(
name: "IX_CMSGovernments_CMSCandidateId",
table: "CMSGovernment",
newName: "IX_CMSGovernment_CMSCandidateId");
migrationBuilder.RenameIndex(
name: "IX_CMSGovernments_CandidateId",
table: "CMSGovernment",
newName: "IX_CMSGovernment_CandidateId");
migrationBuilder.RenameColumn(
name: "Name",
table: "CMSAgency",
newName: "ZipCode");
migrationBuilder.RenameColumn(
name: "Link",
table: "CMSAgency",
newName: "Telephone");
migrationBuilder.RenameIndex(
name: "IX_CMSAgencys_CMSCandidateId",
table: "CMSAgency",
newName: "IX_CMSAgency_CMSCandidateId");
migrationBuilder.RenameIndex(
name: "IX_CMSAgencys_CandidateId",
table: "CMSAgency",
newName: "IX_CMSAgency_CandidateId");
migrationBuilder.AddPrimaryKey(
name: "PK_CMSGovernment",
table: "CMSGovernment",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_CMSAgency",
table: "CMSAgency",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CMSAgency_CMSCandidates_CMSCandidateId",
table: "CMSAgency",
column: "CMSCandidateId",
principalTable: "CMSCandidates",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CMSAgency_Candidates_CandidateId",
table: "CMSAgency",
column: "CandidateId",
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_CMSGovernment_CMSCandidates_CMSCandidateId",
table: "CMSGovernment",
column: "CMSCandidateId",
principalTable: "CMSCandidates",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_CMSGovernment_Candidates_CandidateId",
table: "CMSGovernment",
column: "CandidateId",
principalTable: "Candidates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}