add table certificate

This commit is contained in:
Kittapath 2023-07-05 19:41:40 +07:00
parent 0a626fb393
commit 55a5914967
4 changed files with 10631 additions and 32 deletions

View file

@ -0,0 +1,185 @@
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");
}
}
}

View file

@ -8529,7 +8529,7 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("Placements");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCareer", b =>
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
@ -8538,6 +8538,16 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("CertificateNo")
.HasMaxLength(20)
.HasColumnType("varchar(20)")
.HasComment("เลขที่ใบอนุญาต");
b.Property<string>("CertificateType")
.HasMaxLength(100)
.HasColumnType("varchar(100)")
.HasComment("ชื่อใบอนุญาต");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
@ -8557,13 +8567,18 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<DateTime>("DurationEnd")
b.Property<DateTime?>("ExpireDate")
.HasColumnType("datetime(6)")
.HasComment("ระยะเวลาสิ้นสุด");
.HasComment("วันที่หมดอายุ");
b.Property<DateTime>("DurationStart")
b.Property<DateTime?>("IssueDate")
.HasColumnType("datetime(6)")
.HasComment("ระยะเวลาเริ่ม");
.HasComment("วันที่ออกใบอนุญาต");
b.Property<string>("Issuer")
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasComment("หน่วยงานผู้ออกใบอนุญาต");
b.Property<string>("LastUpdateFullName")
.IsRequired()
@ -8584,34 +8599,14 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext")
.HasComment("สถานที่ทำงาน/ฝึกงาน");
b.Property<Guid>("PlacementProfileId")
.HasColumnType("char(36)");
b.Property<string>("Position")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ตำแหน่ง/ลักษณะงาน");
b.Property<string>("Reason")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เหตุผลที่ออก");
b.Property<int>("Salary")
.HasMaxLength(20)
.HasColumnType("int")
.HasComment("เงินเดือนสุดท้ายก่อนออก");
b.HasKey("Id");
b.HasIndex("PlacementProfileId");
b.ToTable("PlacementCareers");
b.ToTable("PlacementCertificates");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementEducation", b =>
@ -8773,6 +8768,9 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("double")
.HasComment("เงินเดือน");
b.Property<Guid?>("BloodGroupId")
.HasColumnType("char(36)");
b.Property<DateTime?>("CitizenDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่ออกบัตร");
@ -9070,6 +9068,11 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Property<Guid?>("PrefixId")
.HasColumnType("char(36)");
b.Property<string>("Race")
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasComment("เชื้อชาติ");
b.Property<DateTime?>("RecruitDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่บรรจุ");
@ -9110,6 +9113,9 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("longtext")
.HasComment("เหตุผลผ่อนผัน");
b.Property<Guid?>("ReligionId")
.HasColumnType("char(36)");
b.Property<DateTime?>("ReportingDate")
.HasColumnType("datetime(6)")
.HasComment("วันที่รายงานตัว");
@ -9129,6 +9135,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("BloodGroupId");
b.HasIndex("CitizenDistrictId");
b.HasIndex("CitizenProvinceId");
@ -9175,6 +9183,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("ReliefDocId");
b.HasIndex("ReligionId");
b.ToTable("PlacementProfiles");
});
@ -9956,10 +9966,10 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("PlacementType");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCareer", b =>
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementCertificate", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Placement.PlacementProfile", "PlacementProfile")
.WithMany("PlacementCareers")
.WithMany("PlacementCertificates")
.HasForeignKey("PlacementProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -9986,6 +9996,10 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.BloodGroup", "BloodGroup")
.WithMany()
.HasForeignKey("BloodGroupId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.District", "CitizenDistrict")
.WithMany()
.HasForeignKey("CitizenDistrictId");
@ -10078,6 +10092,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany()
.HasForeignKey("ReliefDocId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.Religion", "Religion")
.WithMany()
.HasForeignKey("ReligionId");
b.Navigation("BloodGroup");
b.Navigation("CitizenDistrict");
b.Navigation("CitizenProvince");
@ -10123,6 +10143,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Relationship");
b.Navigation("ReliefDoc");
b.Navigation("Religion");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.LimitLeave", b =>
@ -10299,7 +10321,7 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Placement.PlacementProfile", b =>
{
b.Navigation("PlacementCareers");
b.Navigation("PlacementCertificates");
b.Navigation("PlacementEducations");
});