using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class UpdatetablePlacementProfileadddraft : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.AddColumn( name: "Draft", table: "PlacementProfiles", type: "tinyint(1)", nullable: true, comment: "ข้อมูลตำแหน่ง Draft"); migrationBuilder.CreateTable( name: "InsigniaPeriods", 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"), Name = table.Column(type: "varchar(200)", maxLength: 200, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Year = table.Column(type: "int", nullable: false), StartDate = table.Column(type: "datetime(6)", nullable: false), EndDate = table.Column(type: "datetime(6)", nullable: false), Amount = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Type = table.Column(type: "varchar(10)", maxLength: 10, nullable: false) .Annotation("MySql:CharSet", "utf8mb4") }, constraints: table => { table.PrimaryKey("PK_InsigniaPeriods", x => x.Id); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "InsigniaRequests", 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"), RequestStatus = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), RequestNote = table.Column(type: "text", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), PeriodId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), OrganizationOrganizationId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_InsigniaRequests", x => x.Id); table.ForeignKey( name: "FK_InsigniaRequests_InsigniaPeriods_PeriodId", column: x => x.PeriodId, principalTable: "InsigniaPeriods", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_InsigniaRequests_OrganizationOrganizations_OrganizationOrgan~", column: x => x.OrganizationOrganizationId, principalTable: "OrganizationOrganizations", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "InsigniaRequestProfiles", 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"), RequestDate = table.Column(type: "datetime(6)", nullable: false), Salary = table.Column(type: "decimal(65,30)", nullable: true), IsApprove = table.Column(type: "tinyint(1)", nullable: false), QualificationStatus = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), DocumentStatus = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Note = table.Column(type: "text", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), Special = table.Column(type: "varchar(50)", maxLength: 50, nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), MatchingConditions = table.Column(type: "text", nullable: false) .Annotation("MySql:CharSet", "utf8mb4"), ProfileId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), RequestInsigniaId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), RequestId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_InsigniaRequestProfiles", x => x.Id); table.ForeignKey( name: "FK_InsigniaRequestProfiles_InsigniaRequests_RequestId", column: x => x.RequestId, principalTable: "InsigniaRequests", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_InsigniaRequestProfiles_Insignias_RequestInsigniaId", column: x => x.RequestInsigniaId, principalTable: "Insignias", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_InsigniaRequestProfiles_Profiles_ProfileId", column: x => x.ProfileId, principalTable: "Profiles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_InsigniaRequestProfiles_ProfileId", table: "InsigniaRequestProfiles", column: "ProfileId"); migrationBuilder.CreateIndex( name: "IX_InsigniaRequestProfiles_RequestId", table: "InsigniaRequestProfiles", column: "RequestId"); migrationBuilder.CreateIndex( name: "IX_InsigniaRequestProfiles_RequestInsigniaId", table: "InsigniaRequestProfiles", column: "RequestInsigniaId"); migrationBuilder.CreateIndex( name: "IX_InsigniaRequests_OrganizationOrganizationId", table: "InsigniaRequests", column: "OrganizationOrganizationId"); migrationBuilder.CreateIndex( name: "IX_InsigniaRequests_PeriodId", table: "InsigniaRequests", column: "PeriodId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "InsigniaRequestProfiles"); migrationBuilder.DropTable( name: "InsigniaRequests"); migrationBuilder.DropTable( name: "InsigniaPeriods"); migrationBuilder.DropColumn( name: "Draft", table: "PlacementProfiles"); } } }