using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class addtableRetirementDeceased : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "IsActive", table: "InsigniaPeriods", type: "tinyint(1)", nullable: false, defaultValue: false, comment: "สถานะการใช้งาน"); migrationBuilder.CreateTable( name: "RetirementDeceaseds", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"), CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล") .Annotation("MySql:CharSet", "utf8mb4"), LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด") .Annotation("MySql:CharSet", "utf8mb4"), CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล") .Annotation("MySql:CharSet", "utf8mb4"), LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด") .Annotation("MySql:CharSet", "utf8mb4"), DocumentId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Number = table.Column(type: "longtext", nullable: true, comment: "เลขที่ใบมรณบัตร") .Annotation("MySql:CharSet", "utf8mb4"), Date = table.Column(type: "datetime(6)", nullable: true, comment: "วันที่เสียชีวิต"), Location = table.Column(type: "longtext", nullable: true, comment: "สถานที่ออกใบมรณบัตร") .Annotation("MySql:CharSet", "utf8mb4"), Reason = table.Column(type: "longtext", nullable: true, comment: "เหตุผลการเสียชีวิต") .Annotation("MySql:CharSet", "utf8mb4"), ProfileId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), IsActive = table.Column(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน") }, constraints: table => { table.PrimaryKey("PK_RetirementDeceaseds", x => x.Id); table.ForeignKey( name: "FK_RetirementDeceaseds_Documents_DocumentId", column: x => x.DocumentId, principalTable: "Documents", principalColumn: "Id"); table.ForeignKey( name: "FK_RetirementDeceaseds_Profiles_ProfileId", column: x => x.ProfileId, principalTable: "Profiles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "RetirementResigns", columns: table => new { Id = table.Column(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"), CreatedAt = table.Column(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"), CreatedUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล") .Annotation("MySql:CharSet", "utf8mb4"), LastUpdatedAt = table.Column(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"), LastUpdateUserId = table.Column(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด") .Annotation("MySql:CharSet", "utf8mb4"), CreatedFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล") .Annotation("MySql:CharSet", "utf8mb4"), LastUpdateFullName = table.Column(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด") .Annotation("MySql:CharSet", "utf8mb4"), Location = table.Column(type: "longtext", nullable: true, comment: "สถานที่ยื่นขอลาออกราชการ") .Annotation("MySql:CharSet", "utf8mb4"), SendDate = table.Column(type: "datetime(6)", nullable: true, comment: "วันที่ยื่นขอออกราชการ"), ActiveDate = table.Column(type: "datetime(6)", nullable: true, comment: "วันที่ขอออกราชการ"), Reason = table.Column(type: "longtext", nullable: true, comment: "เหตุผลที่ลาออกจากราชการ") .Annotation("MySql:CharSet", "utf8mb4"), ProfileId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), PositionTypeId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), PositionLineId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), PositionLevelId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), PositionExecutiveId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), OrganizationOrganizationId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Status = table.Column(type: "longtext", nullable: true, comment: "สถานะลาออก") .Annotation("MySql:CharSet", "utf8mb4"), IsActive = table.Column(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน") }, constraints: table => { table.PrimaryKey("PK_RetirementResigns", x => x.Id); table.ForeignKey( name: "FK_RetirementResigns_OrganizationOrganizations_OrganizationOrga~", column: x => x.OrganizationOrganizationId, principalTable: "OrganizationOrganizations", principalColumn: "Id"); table.ForeignKey( name: "FK_RetirementResigns_PositionExecutives_PositionExecutiveId", column: x => x.PositionExecutiveId, principalTable: "PositionExecutives", principalColumn: "Id"); table.ForeignKey( name: "FK_RetirementResigns_PositionLevels_PositionLevelId", column: x => x.PositionLevelId, principalTable: "PositionLevels", principalColumn: "Id"); table.ForeignKey( name: "FK_RetirementResigns_PositionLines_PositionLineId", column: x => x.PositionLineId, principalTable: "PositionLines", principalColumn: "Id"); table.ForeignKey( name: "FK_RetirementResigns_PositionTypes_PositionTypeId", column: x => x.PositionTypeId, principalTable: "PositionTypes", principalColumn: "Id"); table.ForeignKey( name: "FK_RetirementResigns_Profiles_ProfileId", column: x => x.ProfileId, principalTable: "Profiles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_RetirementDeceaseds_DocumentId", table: "RetirementDeceaseds", column: "DocumentId"); migrationBuilder.CreateIndex( name: "IX_RetirementDeceaseds_ProfileId", table: "RetirementDeceaseds", column: "ProfileId"); migrationBuilder.CreateIndex( name: "IX_RetirementResigns_OrganizationOrganizationId", table: "RetirementResigns", column: "OrganizationOrganizationId"); migrationBuilder.CreateIndex( name: "IX_RetirementResigns_PositionExecutiveId", table: "RetirementResigns", column: "PositionExecutiveId"); migrationBuilder.CreateIndex( name: "IX_RetirementResigns_PositionLevelId", table: "RetirementResigns", column: "PositionLevelId"); migrationBuilder.CreateIndex( name: "IX_RetirementResigns_PositionLineId", table: "RetirementResigns", column: "PositionLineId"); migrationBuilder.CreateIndex( name: "IX_RetirementResigns_PositionTypeId", table: "RetirementResigns", column: "PositionTypeId"); migrationBuilder.CreateIndex( name: "IX_RetirementResigns_ProfileId", table: "RetirementResigns", column: "ProfileId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "RetirementDeceaseds"); migrationBuilder.DropTable( name: "RetirementResigns"); migrationBuilder.DropColumn( name: "IsActive", table: "InsigniaPeriods"); } } }