hrms-api-recruit/Migrations/20230502124309_Add Import Image and Document Table2.cs

206 lines
8 KiB
C#

using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Recruit.Service.Migrations
{
/// <inheritdoc />
public partial class AddImportImageandDocumentTable2 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocument_Documents_DocumentId",
table: "RecruitImportDocument");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocument_RecruitImports_RecruitImportId",
table: "RecruitImportDocument");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImage_Documents_DocumentId",
table: "RecruitImportImage");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImage_RecruitImports_RecruitImportId",
table: "RecruitImportImage");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportImage",
table: "RecruitImportImage");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportDocument",
table: "RecruitImportDocument");
migrationBuilder.RenameTable(
name: "RecruitImportImage",
newName: "RecruitImportImages");
migrationBuilder.RenameTable(
name: "RecruitImportDocument",
newName: "RecruitImportDocuments");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImage_RecruitImportId",
table: "RecruitImportImages",
newName: "IX_RecruitImportImages_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImage_DocumentId",
table: "RecruitImportImages",
newName: "IX_RecruitImportImages_DocumentId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocument_RecruitImportId",
table: "RecruitImportDocuments",
newName: "IX_RecruitImportDocuments_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocument_DocumentId",
table: "RecruitImportDocuments",
newName: "IX_RecruitImportDocuments_DocumentId");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportImages",
table: "RecruitImportImages",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportDocuments",
table: "RecruitImportDocuments",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocuments_Documents_DocumentId",
table: "RecruitImportDocuments",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocuments_RecruitImports_RecruitImportId",
table: "RecruitImportDocuments",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImages_Documents_DocumentId",
table: "RecruitImportImages",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImages_RecruitImports_RecruitImportId",
table: "RecruitImportImages",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocuments_Documents_DocumentId",
table: "RecruitImportDocuments");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportDocuments_RecruitImports_RecruitImportId",
table: "RecruitImportDocuments");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImages_Documents_DocumentId",
table: "RecruitImportImages");
migrationBuilder.DropForeignKey(
name: "FK_RecruitImportImages_RecruitImports_RecruitImportId",
table: "RecruitImportImages");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportImages",
table: "RecruitImportImages");
migrationBuilder.DropPrimaryKey(
name: "PK_RecruitImportDocuments",
table: "RecruitImportDocuments");
migrationBuilder.RenameTable(
name: "RecruitImportImages",
newName: "RecruitImportImage");
migrationBuilder.RenameTable(
name: "RecruitImportDocuments",
newName: "RecruitImportDocument");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImages_RecruitImportId",
table: "RecruitImportImage",
newName: "IX_RecruitImportImage_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportImages_DocumentId",
table: "RecruitImportImage",
newName: "IX_RecruitImportImage_DocumentId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocuments_RecruitImportId",
table: "RecruitImportDocument",
newName: "IX_RecruitImportDocument_RecruitImportId");
migrationBuilder.RenameIndex(
name: "IX_RecruitImportDocuments_DocumentId",
table: "RecruitImportDocument",
newName: "IX_RecruitImportDocument_DocumentId");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportImage",
table: "RecruitImportImage",
column: "Id");
migrationBuilder.AddPrimaryKey(
name: "PK_RecruitImportDocument",
table: "RecruitImportDocument",
column: "Id");
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocument_Documents_DocumentId",
table: "RecruitImportDocument",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportDocument_RecruitImports_RecruitImportId",
table: "RecruitImportDocument",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImage_Documents_DocumentId",
table: "RecruitImportImage",
column: "DocumentId",
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_RecruitImportImage_RecruitImports_RecruitImportId",
table: "RecruitImportImage",
column: "RecruitImportId",
principalTable: "RecruitImports",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}