hrms-api-backend/BMA.EHR.Infrastructure/Migrations/20230926094505_update table insignianoteprofile add return.cs

165 lines
6.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableinsignianoteprofileaddreturn : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "DateReceiveInsignia",
table: "InsigniaNoteProfiles",
type: "datetime(6)",
nullable: true,
comment: "วันที่รับเครื่องราชฯ");
migrationBuilder.AddColumn<DateTime>(
name: "DateReturnInsignia",
table: "InsigniaNoteProfiles",
type: "datetime(6)",
nullable: true,
comment: "วันที่คืนเครื่องราชฯ");
migrationBuilder.AddColumn<Guid>(
name: "DocReceiveInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "DocReturnInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.AddColumn<Guid>(
name: "OrgReturnInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci");
migrationBuilder.CreateIndex(
name: "IX_InsigniaNoteProfiles_DocReceiveInsigniaId",
table: "InsigniaNoteProfiles",
column: "DocReceiveInsigniaId");
migrationBuilder.CreateIndex(
name: "IX_InsigniaNoteProfiles_DocReturnInsigniaId",
table: "InsigniaNoteProfiles",
column: "DocReturnInsigniaId");
migrationBuilder.CreateIndex(
name: "IX_InsigniaNoteProfiles_OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles",
column: "OrgReceiveInsigniaId");
migrationBuilder.CreateIndex(
name: "IX_InsigniaNoteProfiles_OrgReturnInsigniaId",
table: "InsigniaNoteProfiles",
column: "OrgReturnInsigniaId");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaNoteProfiles_Documents_DocReceiveInsigniaId",
table: "InsigniaNoteProfiles",
column: "DocReceiveInsigniaId",
principalTable: "Documents",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaNoteProfiles_Documents_DocReturnInsigniaId",
table: "InsigniaNoteProfiles",
column: "DocReturnInsigniaId",
principalTable: "Documents",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReceiveIns~",
table: "InsigniaNoteProfiles",
column: "OrgReceiveInsigniaId",
principalTable: "OrganizationOrganizations",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReturnInsi~",
table: "InsigniaNoteProfiles",
column: "OrgReturnInsigniaId",
principalTable: "OrganizationOrganizations",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InsigniaNoteProfiles_Documents_DocReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropForeignKey(
name: "FK_InsigniaNoteProfiles_Documents_DocReturnInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropForeignKey(
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReceiveIns~",
table: "InsigniaNoteProfiles");
migrationBuilder.DropForeignKey(
name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrgReturnInsi~",
table: "InsigniaNoteProfiles");
migrationBuilder.DropIndex(
name: "IX_InsigniaNoteProfiles_DocReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropIndex(
name: "IX_InsigniaNoteProfiles_DocReturnInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropIndex(
name: "IX_InsigniaNoteProfiles_OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropIndex(
name: "IX_InsigniaNoteProfiles_OrgReturnInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "DateReceiveInsignia",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "DateReturnInsignia",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "DocReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "DocReturnInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "OrgReturnInsigniaId",
table: "InsigniaNoteProfiles");
}
}
}