using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class addtableInsigniaNote : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "InsigniaNotes", 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: true) .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: "int", maxLength: 50, nullable: false), ReliefDocId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Round = table.Column(type: "int", nullable: false, comment: "ราบการยื่นขอ") }, constraints: table => { table.PrimaryKey("PK_InsigniaNotes", x => x.Id); table.ForeignKey( name: "FK_InsigniaNotes_Documents_ReliefDocId", column: x => x.ReliefDocId, principalTable: "Documents", principalColumn: "Id"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "InsigniaNoteDocs", 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: false, collation: "ascii_general_ci"), Reason = table.Column(type: "longtext", nullable: true, comment: "หมายเหตุ") .Annotation("MySql:CharSet", "utf8mb4"), InsigniaNoteId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_InsigniaNoteDocs", x => x.Id); table.ForeignKey( name: "FK_InsigniaNoteDocs_Documents_DocumentId", column: x => x.DocumentId, principalTable: "Documents", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_InsigniaNoteDocs_InsigniaNotes_InsigniaNoteId", column: x => x.InsigniaNoteId, principalTable: "InsigniaNotes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "InsigniaNoteProfiles", 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: true), Salary = table.Column(type: "double", nullable: true), IsApprove = table.Column(type: "tinyint(1)", nullable: false), Status = table.Column(type: "longtext", nullable: false, comment: "สถานะตำแหน่งที่ยื่นขอ") .Annotation("MySql:CharSet", "utf8mb4"), Issue = table.Column(type: "longtext", nullable: true, comment: "หมายเลขประกาศนียบัตรกำกับเครื่องราชฯ") .Annotation("MySql:CharSet", "utf8mb4"), DateReceive = table.Column(type: "datetime(6)", nullable: true, comment: "วันที่ได้รับพระราชทานเครื่องราชฯ"), OrganizationOrganizationSendId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Date = table.Column(type: "datetime(6)", nullable: true, comment: "วันที่"), VolumeNo = table.Column(type: "longtext", nullable: true, comment: "เล่มที่") .Annotation("MySql:CharSet", "utf8mb4"), Section = table.Column(type: "longtext", nullable: true, comment: "ตอนที่") .Annotation("MySql:CharSet", "utf8mb4"), Page = table.Column(type: "longtext", nullable: true, comment: "หน้าที่") .Annotation("MySql:CharSet", "utf8mb4"), No = table.Column(type: "longtext", nullable: true, comment: "ลำดับที่") .Annotation("MySql:CharSet", "utf8mb4"), DatePayment = table.Column(type: "datetime(6)", nullable: true, comment: "วันที่จ่ายใบกำกับ"), TypePayment = table.Column(type: "longtext", nullable: true, comment: "รูปแบบการจ่าย") .Annotation("MySql:CharSet", "utf8mb4"), Address = table.Column(type: "longtext", nullable: true, comment: "ที่อยู่ที่จ่าย") .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"), InsigniaNoteId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_InsigniaNoteProfiles", x => x.Id); table.ForeignKey( name: "FK_InsigniaNoteProfiles_InsigniaNotes_InsigniaNoteId", column: x => x.InsigniaNoteId, principalTable: "InsigniaNotes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_InsigniaNoteProfiles_Insignias_RequestInsigniaId", column: x => x.RequestInsigniaId, principalTable: "Insignias", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_InsigniaNoteProfiles_OrganizationOrganizations_OrganizationO~", column: x => x.OrganizationOrganizationSendId, principalTable: "OrganizationOrganizations", principalColumn: "Id"); table.ForeignKey( name: "FK_InsigniaNoteProfiles_Profiles_ProfileId", column: x => x.ProfileId, principalTable: "Profiles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_InsigniaNoteDocs_DocumentId", table: "InsigniaNoteDocs", column: "DocumentId"); migrationBuilder.CreateIndex( name: "IX_InsigniaNoteDocs_InsigniaNoteId", table: "InsigniaNoteDocs", column: "InsigniaNoteId"); migrationBuilder.CreateIndex( name: "IX_InsigniaNoteProfiles_InsigniaNoteId", table: "InsigniaNoteProfiles", column: "InsigniaNoteId"); migrationBuilder.CreateIndex( name: "IX_InsigniaNoteProfiles_OrganizationOrganizationSendId", table: "InsigniaNoteProfiles", column: "OrganizationOrganizationSendId"); migrationBuilder.CreateIndex( name: "IX_InsigniaNoteProfiles_ProfileId", table: "InsigniaNoteProfiles", column: "ProfileId"); migrationBuilder.CreateIndex( name: "IX_InsigniaNoteProfiles_RequestInsigniaId", table: "InsigniaNoteProfiles", column: "RequestInsigniaId"); migrationBuilder.CreateIndex( name: "IX_InsigniaNotes_ReliefDocId", table: "InsigniaNotes", column: "ReliefDocId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "InsigniaNoteDocs"); migrationBuilder.DropTable( name: "InsigniaNoteProfiles"); migrationBuilder.DropTable( name: "InsigniaNotes"); } } }