using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class AddFieldtoCommandDeploymentTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.RenameColumn( name: "ExamRoundId", table: "Commands", newName: "PlacementId"); migrationBuilder.AddColumn( name: "CitizenId", table: "CommandDeployments", type: "varchar(13)", maxLength: 13, nullable: false, defaultValue: "", comment: "เลขประจำตัวประชาชน") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "FirstName", table: "CommandDeployments", type: "varchar(100)", maxLength: 100, nullable: false, defaultValue: "", comment: "ชื่อ") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "LastName", table: "CommandDeployments", type: "varchar(100)", maxLength: 100, nullable: false, defaultValue: "", comment: "นามสกุล") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "OrganizationName", table: "CommandDeployments", type: "longtext", nullable: false, comment: "ชื่อหน่วยงานของผู้รับสำเนาคำสั่ง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "Prefix", table: "CommandDeployments", type: "varchar(50)", maxLength: 50, nullable: false, defaultValue: "", comment: "คำนำหน้านาม") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "Sequence", table: "CommandDeployments", type: "int", nullable: false, defaultValue: 0, comment: "ลำดับ"); migrationBuilder.CreateIndex( name: "IX_Commands_PlacementId", table: "Commands", column: "PlacementId"); migrationBuilder.AddForeignKey( name: "FK_Commands_Placements_PlacementId", table: "Commands", column: "PlacementId", principalTable: "Placements", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_Commands_Placements_PlacementId", table: "Commands"); migrationBuilder.DropIndex( name: "IX_Commands_PlacementId", table: "Commands"); migrationBuilder.DropColumn( name: "CitizenId", table: "CommandDeployments"); migrationBuilder.DropColumn( name: "FirstName", table: "CommandDeployments"); migrationBuilder.DropColumn( name: "LastName", table: "CommandDeployments"); migrationBuilder.DropColumn( name: "OrganizationName", table: "CommandDeployments"); migrationBuilder.DropColumn( name: "Prefix", table: "CommandDeployments"); migrationBuilder.DropColumn( name: "Sequence", table: "CommandDeployments"); migrationBuilder.RenameColumn( name: "PlacementId", table: "Commands", newName: "ExamRoundId"); } } }