185 lines
10 KiB
C#
185 lines
10 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BMA.EHR.Infrastructure.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class UpdatetablePlacementaddcertificate : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "PlacementCareers");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "BloodGroupId",
|
|
table: "PlacementProfiles",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Race",
|
|
table: "PlacementProfiles",
|
|
type: "varchar(40)",
|
|
maxLength: 40,
|
|
nullable: true,
|
|
comment: "เชื้อชาติ")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "ReligionId",
|
|
table: "PlacementProfiles",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PlacementCertificates",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PlacementProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
CertificateNo = table.Column<string>(type: "varchar(20)", maxLength: 20, nullable: true, comment: "เลขที่ใบอนุญาต")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Issuer = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: true, comment: "หน่วยงานผู้ออกใบอนุญาต")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
IssueDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่ออกใบอนุญาต"),
|
|
ExpireDate = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่หมดอายุ"),
|
|
CertificateType = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: true, comment: "ชื่อใบอนุญาต")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PlacementCertificates", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_PlacementCertificates_PlacementProfiles_PlacementProfileId",
|
|
column: x => x.PlacementProfileId,
|
|
principalTable: "PlacementProfiles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PlacementProfiles_BloodGroupId",
|
|
table: "PlacementProfiles",
|
|
column: "BloodGroupId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PlacementProfiles_ReligionId",
|
|
table: "PlacementProfiles",
|
|
column: "ReligionId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PlacementCertificates_PlacementProfileId",
|
|
table: "PlacementCertificates",
|
|
column: "PlacementProfileId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_PlacementProfiles_BloodGroups_BloodGroupId",
|
|
table: "PlacementProfiles",
|
|
column: "BloodGroupId",
|
|
principalTable: "BloodGroups",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_PlacementProfiles_Religions_ReligionId",
|
|
table: "PlacementProfiles",
|
|
column: "ReligionId",
|
|
principalTable: "Religions",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_PlacementProfiles_BloodGroups_BloodGroupId",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_PlacementProfiles_Religions_ReligionId",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "PlacementCertificates");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_PlacementProfiles_BloodGroupId",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_PlacementProfiles_ReligionId",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "BloodGroupId",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Race",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ReligionId",
|
|
table: "PlacementProfiles");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "PlacementCareers",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PlacementProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DurationEnd = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "ระยะเวลาสิ้นสุด"),
|
|
DurationStart = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "ระยะเวลาเริ่ม"),
|
|
Name = table.Column<string>(type: "longtext", nullable: false, comment: "สถานที่ทำงาน/ฝึกงาน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Position = table.Column<string>(type: "longtext", nullable: false, comment: "ตำแหน่ง/ลักษณะงาน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Reason = table.Column<string>(type: "longtext", nullable: false, comment: "เหตุผลที่ออก")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Salary = table.Column<int>(type: "int", maxLength: 20, nullable: false, comment: "เงินเดือนสุดท้ายก่อนออก")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_PlacementCareers", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_PlacementCareers_PlacementProfiles_PlacementProfileId",
|
|
column: x => x.PlacementProfileId,
|
|
principalTable: "PlacementProfiles",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_PlacementCareers_PlacementProfileId",
|
|
table: "PlacementCareers",
|
|
column: "PlacementProfileId");
|
|
}
|
|
}
|
|
}
|