hrms-api-backend/BMA.EHR.Infrastructure/Migrations/20241121034320_update table insignia add OrgReceiveInsigniaId.cs
2024-11-21 12:16:52 +07:00

131 lines
5.2 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updatetableinsigniaaddOrgReceiveInsigniaId : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InsigniaNoteProfiles_Organizations_OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropForeignKey(
name: "FK_InsigniaNoteProfiles_Organizations_OrgReturnInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropIndex(
name: "IX_InsigniaNoteProfiles_OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.DropIndex(
name: "IX_InsigniaNoteProfiles_OrgReturnInsigniaId",
table: "InsigniaNoteProfiles");
migrationBuilder.AlterColumn<Guid>(
name: "OrgReturnInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
comment: "หน่วยงานคืนเครื่องราชฯ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
comment: "หน่วยงานรับเครื่องราชฯ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<string>(
name: "OrgReceiveInsignia",
table: "InsigniaNoteProfiles",
type: "longtext",
nullable: true,
comment: "หน่วยงานรับเครื่องราชฯ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "OrgReturnInsignia",
table: "InsigniaNoteProfiles",
type: "longtext",
nullable: true,
comment: "หน่วยงานคืนเครื่องราชฯ")
.Annotation("MySql:CharSet", "utf8mb4");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "OrgReceiveInsignia",
table: "InsigniaNoteProfiles");
migrationBuilder.DropColumn(
name: "OrgReturnInsignia",
table: "InsigniaNoteProfiles");
migrationBuilder.AlterColumn<Guid>(
name: "OrgReturnInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "หน่วยงานคืนเครื่องราชฯ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "หน่วยงานรับเครื่องราชฯ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
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_Organizations_OrgReceiveInsigniaId",
table: "InsigniaNoteProfiles",
column: "OrgReceiveInsigniaId",
principalTable: "Organizations",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaNoteProfiles_Organizations_OrgReturnInsigniaId",
table: "InsigniaNoteProfiles",
column: "OrgReturnInsigniaId",
principalTable: "Organizations",
principalColumn: "Id");
}
}
}