using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class updatetablePlacementReciveaddchild1 : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_OrganizationPositions_OrganizationPosition~", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_PositionLevels_PositionLevelId", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_PositionLines_PositionLineId", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_PositionNumbers_PositionNumberId", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_PositionPathSides_PositionPathSideId", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_PositionPaths_PositionPathId", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_PositionTypes_PositionTypeId", table: "PlacementReceives"); migrationBuilder.DropForeignKey( name: "FK_PlacementReceives_Prefixes_PrefixId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_OrganizationPositionId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PositionLevelId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PositionLineId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PositionNumberId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PositionPathId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PositionPathSideId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PositionTypeId", table: "PlacementReceives"); migrationBuilder.DropIndex( name: "IX_PlacementReceives_PrefixId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "OrganizationPositionId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PositionLevelId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PositionLineId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PositionNumberId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PositionPathId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PositionPathSideId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PositionTypeId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "PrefixId", table: "PlacementReceives"); migrationBuilder.RenameColumn( name: "Lastname", table: "PlacementReceives", newName: "lastName"); migrationBuilder.RenameColumn( name: "Firstname", table: "PlacementReceives", newName: "firstName"); migrationBuilder.RenameColumn( name: "CitizenId", table: "PlacementReceives", newName: "citizenId"); migrationBuilder.AlterColumn( name: "lastName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "นามสกุล", oldClrType: typeof(string), oldType: "longtext", oldComment: "นามสกุล") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "firstName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อ", oldClrType: typeof(string), oldType: "longtext", oldComment: "ชื่อ") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AlterColumn( name: "citizenId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "เลขบัตรประชาชน", oldClrType: typeof(string), oldType: "varchar(20)", oldMaxLength: 20, oldComment: "เลขประจำตัวประชาชน") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child1", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child1") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child1Id", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id หน่วยงาน child1") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child1ShortName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child1") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child2", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child2") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child2Id", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id หน่วยงาน child2") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child2ShortName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child2") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child3", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child3") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child3Id", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id หน่วยงาน child3") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child3ShortName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child3") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child4", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน child4") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child4Id", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id หน่วยงาน child4") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "child4ShortName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน child4") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "node", table: "PlacementReceives", type: "int", nullable: true, comment: "ระดับโครงสร้าง"); migrationBuilder.AddColumn( name: "nodeId", table: "PlacementReceives", type: "char(36)", nullable: true, comment: "id โครงสร้าง", collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "orgRevisionId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id revision") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "posLevelId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id ระดับตำแหน่ง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "posLevelName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อระดับตำแหน่ง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "posMasterNo", table: "PlacementReceives", type: "int", nullable: true, comment: "เลขที่ตำแหน่ง"); migrationBuilder.AddColumn( name: "posTypeId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id ประเภทตำแหน่ง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "posTypeName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อประเภทตำแหน่ง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "positionField", table: "PlacementReceives", type: "longtext", nullable: true, comment: "สายงาน") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "positionId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id ตำแหน่ง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "positionName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อตำแหน่งในสายงาน") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "posmasterId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id อัตรากำลัง") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "prefix", table: "PlacementReceives", type: "longtext", nullable: true, comment: "คำนำหน้า") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "profileId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "profile Id") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "root", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อหน่วยงาน root") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "rootId", table: "PlacementReceives", type: "longtext", nullable: true, comment: "id หน่วยงาน root") .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "rootShortName", table: "PlacementReceives", type: "longtext", nullable: true, comment: "ชื่อย่อหน่วยงาน root") .Annotation("MySql:CharSet", "utf8mb4"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "child1", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child1Id", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child1ShortName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child2", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child2Id", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child2ShortName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child3", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child3Id", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child3ShortName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child4", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child4Id", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "child4ShortName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "node", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "nodeId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "orgRevisionId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "posLevelId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "posLevelName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "posMasterNo", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "posTypeId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "posTypeName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "positionField", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "positionId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "positionName", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "posmasterId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "prefix", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "profileId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "root", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "rootId", table: "PlacementReceives"); migrationBuilder.DropColumn( name: "rootShortName", table: "PlacementReceives"); migrationBuilder.RenameColumn( name: "lastName", table: "PlacementReceives", newName: "Lastname"); migrationBuilder.RenameColumn( name: "firstName", table: "PlacementReceives", newName: "Firstname"); migrationBuilder.RenameColumn( name: "citizenId", table: "PlacementReceives", newName: "CitizenId"); migrationBuilder.UpdateData( table: "PlacementReceives", keyColumn: "Lastname", keyValue: null, column: "Lastname", value: ""); migrationBuilder.AlterColumn( name: "Lastname", table: "PlacementReceives", type: "longtext", nullable: false, comment: "นามสกุล", oldClrType: typeof(string), oldType: "longtext", oldNullable: true, oldComment: "นามสกุล") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.UpdateData( table: "PlacementReceives", keyColumn: "Firstname", keyValue: null, column: "Firstname", value: ""); migrationBuilder.AlterColumn( name: "Firstname", table: "PlacementReceives", type: "longtext", nullable: false, comment: "ชื่อ", oldClrType: typeof(string), oldType: "longtext", oldNullable: true, oldComment: "ชื่อ") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.UpdateData( table: "PlacementReceives", keyColumn: "CitizenId", keyValue: null, column: "CitizenId", value: ""); migrationBuilder.AlterColumn( name: "CitizenId", table: "PlacementReceives", type: "varchar(20)", maxLength: 20, nullable: false, comment: "เลขประจำตัวประชาชน", oldClrType: typeof(string), oldType: "longtext", oldNullable: true, oldComment: "เลขบัตรประชาชน") .Annotation("MySql:CharSet", "utf8mb4") .OldAnnotation("MySql:CharSet", "utf8mb4"); migrationBuilder.AddColumn( name: "OrganizationPositionId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PositionLevelId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PositionLineId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PositionNumberId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PositionPathId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PositionPathSideId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PositionTypeId", table: "PlacementReceives", type: "char(36)", nullable: true, collation: "ascii_general_ci"); migrationBuilder.AddColumn( name: "PrefixId", table: "PlacementReceives", type: "char(36)", nullable: false, defaultValue: new Guid("00000000-0000-0000-0000-000000000000"), collation: "ascii_general_ci"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_OrganizationPositionId", table: "PlacementReceives", column: "OrganizationPositionId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PositionLevelId", table: "PlacementReceives", column: "PositionLevelId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PositionLineId", table: "PlacementReceives", column: "PositionLineId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PositionNumberId", table: "PlacementReceives", column: "PositionNumberId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PositionPathId", table: "PlacementReceives", column: "PositionPathId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PositionPathSideId", table: "PlacementReceives", column: "PositionPathSideId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PositionTypeId", table: "PlacementReceives", column: "PositionTypeId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PrefixId", table: "PlacementReceives", column: "PrefixId"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_OrganizationPositions_OrganizationPosition~", table: "PlacementReceives", column: "OrganizationPositionId", principalTable: "OrganizationPositions", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_PositionLevels_PositionLevelId", table: "PlacementReceives", column: "PositionLevelId", principalTable: "PositionLevels", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_PositionLines_PositionLineId", table: "PlacementReceives", column: "PositionLineId", principalTable: "PositionLines", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_PositionNumbers_PositionNumberId", table: "PlacementReceives", column: "PositionNumberId", principalTable: "PositionNumbers", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_PositionPathSides_PositionPathSideId", table: "PlacementReceives", column: "PositionPathSideId", principalTable: "PositionPathSides", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_PositionPaths_PositionPathId", table: "PlacementReceives", column: "PositionPathId", principalTable: "PositionPaths", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_PositionTypes_PositionTypeId", table: "PlacementReceives", column: "PositionTypeId", principalTable: "PositionTypes", principalColumn: "Id"); migrationBuilder.AddForeignKey( name: "FK_PlacementReceives_Prefixes_PrefixId", table: "PlacementReceives", column: "PrefixId", principalTable: "Prefixes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); } } }