using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class addtableplacementtransfer : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "PlacementReceives", 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"), CitizenId = table.Column(type: "varchar(20)", maxLength: 20, nullable: false, comment: "เลขประจำตัวประชาชน") .Annotation("MySql:CharSet", "utf8mb4"), PrefixId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Firstname = table.Column(type: "longtext", nullable: false, comment: "ชื่อ") .Annotation("MySql:CharSet", "utf8mb4"), Lastname = table.Column(type: "longtext", nullable: false, comment: "นามสกุล") .Annotation("MySql:CharSet", "utf8mb4"), DateOfBirth = table.Column(type: "datetime(6)", maxLength: 40, nullable: false, comment: "วันเกิด"), GenderId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), Nationality = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, comment: "สัญชาติ") .Annotation("MySql:CharSet", "utf8mb4"), Race = table.Column(type: "varchar(100)", maxLength: 100, nullable: true, comment: "เชื้อชาติ") .Annotation("MySql:CharSet", "utf8mb4"), ReligionId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), BloodGroupId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), RelationshipId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), TelephoneNumber = table.Column(type: "varchar(50)", maxLength: 50, nullable: true, comment: "เบอร์โทร") .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "longtext", nullable: false, comment: "สถานะคำขอ") .Annotation("MySql:CharSet", "utf8mb4"), OrganizationId = table.Column(type: "char(36)", nullable: true, collation: "ascii_general_ci"), IsActive = table.Column(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน") }, constraints: table => { table.PrimaryKey("PK_PlacementReceives", x => x.Id); table.ForeignKey( name: "FK_PlacementReceives_BloodGroups_BloodGroupId", column: x => x.BloodGroupId, principalTable: "BloodGroups", principalColumn: "Id"); table.ForeignKey( name: "FK_PlacementReceives_Genders_GenderId", column: x => x.GenderId, principalTable: "Genders", principalColumn: "Id"); table.ForeignKey( name: "FK_PlacementReceives_Organizations_OrganizationId", column: x => x.OrganizationId, principalTable: "Organizations", principalColumn: "Id"); table.ForeignKey( name: "FK_PlacementReceives_Prefixes_PrefixId", column: x => x.PrefixId, principalTable: "Prefixes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PlacementReceives_Relationships_RelationshipId", column: x => x.RelationshipId, principalTable: "Relationships", principalColumn: "Id"); table.ForeignKey( name: "FK_PlacementReceives_Religions_ReligionId", column: x => x.ReligionId, principalTable: "Religions", principalColumn: "Id"); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "PlacementTransfers", 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"), ProfileId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"), Organization = table.Column(type: "longtext", nullable: true, comment: "หน่วยงานที่ขอโอนไป") .Annotation("MySql:CharSet", "utf8mb4"), Reason = table.Column(type: "longtext", nullable: true, comment: "เหตุผล") .Annotation("MySql:CharSet", "utf8mb4"), Status = table.Column(type: "longtext", nullable: false, comment: "สถานะคำขอ") .Annotation("MySql:CharSet", "utf8mb4"), IsActive = table.Column(type: "tinyint(1)", nullable: false, comment: "สถานะการใช้งาน") }, constraints: table => { table.PrimaryKey("PK_PlacementTransfers", x => x.Id); table.ForeignKey( name: "FK_PlacementTransfers_Profiles_ProfileId", column: x => x.ProfileId, principalTable: "Profiles", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "PlacementReceiveDocs", 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"), PlacementReceiveId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_PlacementReceiveDocs", x => x.Id); table.ForeignKey( name: "FK_PlacementReceiveDocs_Documents_DocumentId", column: x => x.DocumentId, principalTable: "Documents", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PlacementReceiveDocs_PlacementReceives_PlacementReceiveId", column: x => x.PlacementReceiveId, principalTable: "PlacementReceives", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateTable( name: "PlacementTransferDocs", 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"), PlacementTransferId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci") }, constraints: table => { table.PrimaryKey("PK_PlacementTransferDocs", x => x.Id); table.ForeignKey( name: "FK_PlacementTransferDocs_Documents_DocumentId", column: x => x.DocumentId, principalTable: "Documents", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_PlacementTransferDocs_PlacementTransfers_PlacementTransferId", column: x => x.PlacementTransferId, principalTable: "PlacementTransfers", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }) .Annotation("MySql:CharSet", "utf8mb4"); migrationBuilder.CreateIndex( name: "IX_PlacementReceiveDocs_DocumentId", table: "PlacementReceiveDocs", column: "DocumentId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceiveDocs_PlacementReceiveId", table: "PlacementReceiveDocs", column: "PlacementReceiveId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_BloodGroupId", table: "PlacementReceives", column: "BloodGroupId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_GenderId", table: "PlacementReceives", column: "GenderId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_OrganizationId", table: "PlacementReceives", column: "OrganizationId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_PrefixId", table: "PlacementReceives", column: "PrefixId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_RelationshipId", table: "PlacementReceives", column: "RelationshipId"); migrationBuilder.CreateIndex( name: "IX_PlacementReceives_ReligionId", table: "PlacementReceives", column: "ReligionId"); migrationBuilder.CreateIndex( name: "IX_PlacementTransferDocs_DocumentId", table: "PlacementTransferDocs", column: "DocumentId"); migrationBuilder.CreateIndex( name: "IX_PlacementTransferDocs_PlacementTransferId", table: "PlacementTransferDocs", column: "PlacementTransferId"); migrationBuilder.CreateIndex( name: "IX_PlacementTransfers_ProfileId", table: "PlacementTransfers", column: "ProfileId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "PlacementReceiveDocs"); migrationBuilder.DropTable( name: "PlacementTransferDocs"); migrationBuilder.DropTable( name: "PlacementReceives"); migrationBuilder.DropTable( name: "PlacementTransfers"); } } }