Merge branch 'develop' into working

This commit is contained in:
suphonchai Phoonsawat 2023-07-24 09:06:48 +07:00
commit 35c0342934
38 changed files with 32780 additions and 5367 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,578 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class AddTableretire : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InsigniaRequests_OrganizationOrganizations_OrganizationOrgan~",
table: "InsigniaRequests");
migrationBuilder.DropColumn(
name: "PosNo",
table: "Profiles");
migrationBuilder.DropColumn(
name: "Position",
table: "Profiles");
migrationBuilder.DropColumn(
name: "PositionLevel",
table: "Profiles");
migrationBuilder.DropColumn(
name: "PositionType",
table: "Profiles");
migrationBuilder.DropColumn(
name: "Insignia",
table: "ProfileInsignias");
migrationBuilder.DropColumn(
name: "Number",
table: "PlacementProfiles");
migrationBuilder.RenameColumn(
name: "OrganizationOrganizationId",
table: "InsigniaRequests",
newName: "OrganizationId");
migrationBuilder.RenameIndex(
name: "IX_InsigniaRequests_OrganizationOrganizationId",
table: "InsigniaRequests",
newName: "IX_InsigniaRequests_OrganizationId");
migrationBuilder.AlterColumn<Guid>(
name: "PositionLevelId",
table: "ProfileSalaries",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Id ระดับ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AddColumn<int>(
name: "Order",
table: "ProfileSalaries",
type: "int",
nullable: true,
comment: "ลำดับ");
migrationBuilder.AlterColumn<Guid>(
name: "PrefixId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Id คำนำหน้า")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PositionTypeId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Id ประเภทตำแหน่ง")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PositionLevelId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: " Id ระดับ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PositionId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Id ตำแหน่ง")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PosNoId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Id เลขที่ตำแหน่ง")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "GenderId",
table: "Profiles",
type: "char(36)",
nullable: true,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true,
oldComment: "Id เพศ")
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "Profiles",
type: "char(36)",
nullable: false,
comment: "PrimaryKey",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)")
.Annotation("Relational:ColumnOrder", 0)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.CreateTable(
name: "Retirements",
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"),
Round = table.Column<int>(type: "int", nullable: false, comment: "ครั้งที่"),
Type = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภท")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Retirements", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateTable(
name: "RetirementProfiles",
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"),
Order = table.Column<int>(type: "int", nullable: false, comment: "ลำดับที่"),
Reason = table.Column<string>(type: "longtext", nullable: false, comment: "เหตุผล")
.Annotation("MySql:CharSet", "utf8mb4"),
Remove = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ลบออกจากเกษียญ"),
RetirementId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
ProfileId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
},
constraints: table =>
{
table.PrimaryKey("PK_RetirementProfiles", x => x.Id);
table.ForeignKey(
name: "FK_RetirementProfiles_Profiles_ProfileId",
column: x => x.ProfileId,
principalTable: "Profiles",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_RetirementProfiles_Retirements_RetirementId",
column: x => x.RetirementId,
principalTable: "Retirements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_ProfileSalaries_PositionLevelId",
table: "ProfileSalaries",
column: "PositionLevelId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_GenderId",
table: "Profiles",
column: "GenderId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_PositionId",
table: "Profiles",
column: "PositionId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_PositionLevelId",
table: "Profiles",
column: "PositionLevelId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_PositionTypeId",
table: "Profiles",
column: "PositionTypeId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_PosNoId",
table: "Profiles",
column: "PosNoId");
migrationBuilder.CreateIndex(
name: "IX_Profiles_PrefixId",
table: "Profiles",
column: "PrefixId");
migrationBuilder.CreateIndex(
name: "IX_ProfileInsignias_InsigniaId",
table: "ProfileInsignias",
column: "InsigniaId");
migrationBuilder.CreateIndex(
name: "IX_RetirementProfiles_ProfileId",
table: "RetirementProfiles",
column: "ProfileId");
migrationBuilder.CreateIndex(
name: "IX_RetirementProfiles_RetirementId",
table: "RetirementProfiles",
column: "RetirementId");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaRequests_Organizations_OrganizationId",
table: "InsigniaRequests",
column: "OrganizationId",
principalTable: "Organizations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
migrationBuilder.AddForeignKey(
name: "FK_ProfileInsignias_Insignias_InsigniaId",
table: "ProfileInsignias",
column: "InsigniaId",
principalTable: "Insignias",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_Genders_GenderId",
table: "Profiles",
column: "GenderId",
principalTable: "Genders",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_PositionLevels_PositionLevelId",
table: "Profiles",
column: "PositionLevelId",
principalTable: "PositionLevels",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_PositionNumbers_PosNoId",
table: "Profiles",
column: "PosNoId",
principalTable: "PositionNumbers",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_PositionPaths_PositionId",
table: "Profiles",
column: "PositionId",
principalTable: "PositionPaths",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_PositionTypes_PositionTypeId",
table: "Profiles",
column: "PositionTypeId",
principalTable: "PositionTypes",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_Profiles_Prefixes_PrefixId",
table: "Profiles",
column: "PrefixId",
principalTable: "Prefixes",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_ProfileSalaries_PositionLevels_PositionLevelId",
table: "ProfileSalaries",
column: "PositionLevelId",
principalTable: "PositionLevels",
principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InsigniaRequests_Organizations_OrganizationId",
table: "InsigniaRequests");
migrationBuilder.DropForeignKey(
name: "FK_ProfileInsignias_Insignias_InsigniaId",
table: "ProfileInsignias");
migrationBuilder.DropForeignKey(
name: "FK_Profiles_Genders_GenderId",
table: "Profiles");
migrationBuilder.DropForeignKey(
name: "FK_Profiles_PositionLevels_PositionLevelId",
table: "Profiles");
migrationBuilder.DropForeignKey(
name: "FK_Profiles_PositionNumbers_PosNoId",
table: "Profiles");
migrationBuilder.DropForeignKey(
name: "FK_Profiles_PositionPaths_PositionId",
table: "Profiles");
migrationBuilder.DropForeignKey(
name: "FK_Profiles_PositionTypes_PositionTypeId",
table: "Profiles");
migrationBuilder.DropForeignKey(
name: "FK_Profiles_Prefixes_PrefixId",
table: "Profiles");
migrationBuilder.DropForeignKey(
name: "FK_ProfileSalaries_PositionLevels_PositionLevelId",
table: "ProfileSalaries");
migrationBuilder.DropTable(
name: "RetirementProfiles");
migrationBuilder.DropTable(
name: "Retirements");
migrationBuilder.DropIndex(
name: "IX_ProfileSalaries_PositionLevelId",
table: "ProfileSalaries");
migrationBuilder.DropIndex(
name: "IX_Profiles_GenderId",
table: "Profiles");
migrationBuilder.DropIndex(
name: "IX_Profiles_PositionId",
table: "Profiles");
migrationBuilder.DropIndex(
name: "IX_Profiles_PositionLevelId",
table: "Profiles");
migrationBuilder.DropIndex(
name: "IX_Profiles_PositionTypeId",
table: "Profiles");
migrationBuilder.DropIndex(
name: "IX_Profiles_PosNoId",
table: "Profiles");
migrationBuilder.DropIndex(
name: "IX_Profiles_PrefixId",
table: "Profiles");
migrationBuilder.DropIndex(
name: "IX_ProfileInsignias_InsigniaId",
table: "ProfileInsignias");
migrationBuilder.DropColumn(
name: "Order",
table: "ProfileSalaries");
migrationBuilder.RenameColumn(
name: "OrganizationId",
table: "InsigniaRequests",
newName: "OrganizationOrganizationId");
migrationBuilder.RenameIndex(
name: "IX_InsigniaRequests_OrganizationId",
table: "InsigniaRequests",
newName: "IX_InsigniaRequests_OrganizationOrganizationId");
migrationBuilder.AlterColumn<Guid>(
name: "PositionLevelId",
table: "ProfileSalaries",
type: "char(36)",
nullable: true,
comment: "Id ระดับ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PrefixId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: "Id คำนำหน้า",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PositionTypeId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: "Id ประเภทตำแหน่ง",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PositionLevelId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: " Id ระดับ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PositionId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: "Id ตำแหน่ง",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "PosNoId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: "Id เลขที่ตำแหน่ง",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "GenderId",
table: "Profiles",
type: "char(36)",
nullable: true,
comment: "Id เพศ",
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldNullable: true)
.OldAnnotation("Relational:Collation", "ascii_general_ci");
migrationBuilder.AlterColumn<Guid>(
name: "Id",
table: "Profiles",
type: "char(36)",
nullable: false,
collation: "ascii_general_ci",
oldClrType: typeof(Guid),
oldType: "char(36)",
oldComment: "PrimaryKey")
.OldAnnotation("Relational:Collation", "ascii_general_ci")
.OldAnnotation("Relational:ColumnOrder", 0);
migrationBuilder.AddColumn<string>(
name: "PosNo",
table: "Profiles",
type: "longtext",
nullable: true,
comment: "เลขที่ตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Position",
table: "Profiles",
type: "longtext",
nullable: true,
comment: "ตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionLevel",
table: "Profiles",
type: "longtext",
nullable: true,
comment: "ระดับ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "PositionType",
table: "Profiles",
type: "longtext",
nullable: true,
comment: "ประเภทตำแหน่ง")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<string>(
name: "Insignia",
table: "ProfileInsignias",
type: "longtext",
nullable: true,
comment: "ชื่อเครื่องราชฯ")
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddColumn<int>(
name: "Number",
table: "PlacementProfiles",
type: "int",
nullable: true,
comment: "ลำดับที่สอบได้");
migrationBuilder.AddForeignKey(
name: "FK_InsigniaRequests_OrganizationOrganizations_OrganizationOrgan~",
table: "InsigniaRequests",
column: "OrganizationOrganizationId",
principalTable: "OrganizationOrganizations",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -0,0 +1,119 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class updateTableretiretoRetirementPeriod : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RetirementProfiles_Retirements_RetirementId",
table: "RetirementProfiles");
migrationBuilder.DropTable(
name: "Retirements");
migrationBuilder.RenameColumn(
name: "RetirementId",
table: "RetirementProfiles",
newName: "RetirementPeriodId");
migrationBuilder.RenameIndex(
name: "IX_RetirementProfiles_RetirementId",
table: "RetirementProfiles",
newName: "IX_RetirementProfiles_RetirementPeriodId");
migrationBuilder.CreateTable(
name: "RetirementPeriods",
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"),
Round = table.Column<int>(type: "int", nullable: false, comment: "ครั้งที่"),
Type = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภท")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_RetirementPeriods", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddForeignKey(
name: "FK_RetirementProfiles_RetirementPeriods_RetirementPeriodId",
table: "RetirementProfiles",
column: "RetirementPeriodId",
principalTable: "RetirementPeriods",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_RetirementProfiles_RetirementPeriods_RetirementPeriodId",
table: "RetirementProfiles");
migrationBuilder.DropTable(
name: "RetirementPeriods");
migrationBuilder.RenameColumn(
name: "RetirementPeriodId",
table: "RetirementProfiles",
newName: "RetirementId");
migrationBuilder.RenameIndex(
name: "IX_RetirementProfiles_RetirementPeriodId",
table: "RetirementProfiles",
newName: "IX_RetirementProfiles_RetirementId");
migrationBuilder.CreateTable(
name: "Retirements",
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"),
Round = table.Column<int>(type: "int", nullable: false, comment: "ครั้งที่"),
Type = table.Column<string>(type: "longtext", nullable: false, comment: "ประเภท")
.Annotation("MySql:CharSet", "utf8mb4")
},
constraints: table =>
{
table.PrimaryKey("PK_Retirements", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.AddForeignKey(
name: "FK_RetirementProfiles_Retirements_RetirementId",
table: "RetirementProfiles",
column: "RetirementId",
principalTable: "Retirements",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View file

@ -570,7 +570,10 @@ namespace BMA.EHR.Infrastructure.Migrations
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)");
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<string>("Ability")
.IsRequired()
@ -731,8 +734,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("ชื่อ(เดิม)");
b.Property<Guid?>("GenderId")
.HasColumnType("char(36)")
.HasComment("Id เพศ");
.HasColumnType("char(36)");
b.Property<int>("GovAgeAbsent")
.HasColumnType("int");
@ -864,21 +866,12 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(100)")
.HasComment("สถานภาพทางกาย");
b.Property<string>("PosNo")
.HasColumnType("longtext")
.HasComment("เลขที่ตำแหน่ง");
b.Property<string>("PosNoEmployee")
.HasColumnType("longtext")
.HasComment("เลขที่ตำแหน่งลูกจ้าง");
b.Property<Guid?>("PosNoId")
.HasColumnType("char(36)")
.HasComment("Id เลขที่ตำแหน่ง");
b.Property<string>("Position")
.HasColumnType("longtext")
.HasComment("ตำแหน่ง");
.HasColumnType("char(36)");
b.Property<string>("PositionEmployeeGroup")
.HasColumnType("longtext")
@ -929,16 +922,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("Id ด้านทางการบริหาร");
b.Property<Guid?>("PositionId")
.HasColumnType("char(36)")
.HasComment("Id ตำแหน่ง");
b.Property<string>("PositionLevel")
.HasColumnType("longtext")
.HasComment("ระดับ");
.HasColumnType("char(36)");
b.Property<Guid?>("PositionLevelId")
.HasColumnType("char(36)")
.HasComment(" Id ระดับ");
.HasColumnType("char(36)");
b.Property<string>("PositionLine")
.HasColumnType("longtext")
@ -956,17 +943,11 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)")
.HasComment("Id ด้าน/สาขา");
b.Property<string>("PositionType")
.HasColumnType("longtext")
.HasComment("ประเภทตำแหน่ง");
b.Property<Guid?>("PositionTypeId")
.HasColumnType("char(36)")
.HasComment("Id ประเภทตำแหน่ง");
.HasColumnType("char(36)");
b.Property<Guid?>("PrefixId")
.HasColumnType("char(36)")
.HasComment("Id คำนำหน้า");
.HasColumnType("char(36)");
b.Property<Guid?>("PrefixOldId")
.HasColumnType("char(36)")
@ -1038,8 +1019,20 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasIndex("AvatarId");
b.HasIndex("GenderId");
b.HasIndex("LimitLeaveId");
b.HasIndex("PosNoId");
b.HasIndex("PositionId");
b.HasIndex("PositionLevelId");
b.HasIndex("PositionTypeId");
b.HasIndex("PrefixId");
b.ToTable("Profiles");
});
@ -3323,10 +3316,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("datetime(6)")
.HasComment("วันที่ประกาศในราชกิจจาฯ");
b.Property<string>("Insignia")
.HasColumnType("longtext")
.HasComment("ชื่อเครื่องราชฯ");
b.Property<Guid?>("InsigniaId")
.HasColumnType("char(36)");
@ -3396,6 +3385,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("InsigniaId");
b.HasIndex("ProfileId");
b.ToTable("ProfileInsignias");
@ -4235,6 +4226,10 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("char(36)")
.HasComment("Id สังกัด");
b.Property<int?>("Order")
.HasColumnType("int")
.HasComment("ลำดับ");
b.Property<Guid?>("OrganizationShortNameId")
.HasColumnType("char(36)")
.HasComment("Id ชื่อย่อหน่วยงาน");
@ -4276,8 +4271,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasComment("Id ตำแหน่ง");
b.Property<Guid?>("PositionLevelId")
.HasColumnType("char(36)")
.HasComment("Id ระดับ");
.HasColumnType("char(36)");
b.Property<Guid?>("PositionLineId")
.HasColumnType("char(36)")
@ -4308,6 +4302,8 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("PositionLevelId");
b.HasIndex("ProfileId");
b.ToTable("ProfileSalaries");
@ -4985,7 +4981,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<Guid>("OrganizationOrganizationId")
b.Property<Guid>("OrganizationId")
.HasColumnType("char(36)");
b.Property<Guid>("PeriodId")
@ -5002,7 +4998,7 @@ namespace BMA.EHR.Infrastructure.Migrations
b.HasKey("Id");
b.HasIndex("OrganizationOrganizationId");
b.HasIndex("OrganizationId");
b.HasIndex("PeriodId");
@ -9989,10 +9985,6 @@ namespace BMA.EHR.Infrastructure.Migrations
.HasColumnType("varchar(40)")
.HasComment("สัญชาติ");
b.Property<int?>("Number")
.HasColumnType("int")
.HasComment("ลำดับที่สอบได้");
b.Property<string>("OccupationCompany")
.HasColumnType("longtext")
.HasComment("สำนัก/บริษัท บริษัท");
@ -10269,6 +10261,142 @@ namespace BMA.EHR.Infrastructure.Migrations
b.ToTable("PlacementTypes");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<int>("Round")
.HasColumnType("int")
.HasComment("ครั้งที่");
b.Property<string>("Type")
.IsRequired()
.HasColumnType("longtext")
.HasComment("ประเภท");
b.HasKey("Id");
b.ToTable("RetirementPeriods");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementProfile", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("char(36)")
.HasColumnOrder(0)
.HasComment("PrimaryKey")
.HasAnnotation("Relational:JsonPropertyName", "id");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(100)
.HasComment("สร้างข้อมูลเมื่อ");
b.Property<string>("CreatedFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(104)
.HasComment("ชื่อ User ที่สร้างข้อมูล");
b.Property<string>("CreatedUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(101)
.HasComment("User Id ที่สร้างข้อมูล");
b.Property<string>("LastUpdateFullName")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("varchar(200)")
.HasColumnOrder(105)
.HasComment("ชื่อ User ที่แก้ไขข้อมูลล่าสุด");
b.Property<string>("LastUpdateUserId")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnOrder(103)
.HasComment("User Id ที่แก้ไขข้อมูลล่าสุด");
b.Property<DateTime?>("LastUpdatedAt")
.HasColumnType("datetime(6)")
.HasColumnOrder(102)
.HasComment("แก้ไขข้อมูลล่าสุดเมื่อ");
b.Property<int>("Order")
.HasColumnType("int")
.HasComment("ลำดับที่");
b.Property<Guid>("ProfileId")
.HasColumnType("char(36)");
b.Property<string>("Reason")
.IsRequired()
.HasColumnType("longtext")
.HasComment("เหตุผล");
b.Property<bool>("Remove")
.HasColumnType("tinyint(1)")
.HasComment("ลบออกจากเกษียญ");
b.Property<Guid>("RetirementPeriodId")
.HasColumnType("char(36)");
b.HasKey("Id");
b.HasIndex("ProfileId");
b.HasIndex("RetirementPeriodId");
b.ToTable("RetirementProfiles");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
{
b.HasOne("BMA.EHR.Domain.Models.Commands.Core.CommandStatus", "CommandStatus")
@ -10328,13 +10456,49 @@ namespace BMA.EHR.Infrastructure.Migrations
.WithMany()
.HasForeignKey("AvatarId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.Gender", "Gender")
.WithMany()
.HasForeignKey("GenderId");
b.HasOne("BMA.EHR.Domain.Models.HR.LimitLeave", "LimitLeave")
.WithMany("Profiles")
.HasForeignKey("LimitLeaveId");
b.HasOne("BMA.EHR.Domain.Models.Organizations.PositionNumberEntity", "PosNo")
.WithMany()
.HasForeignKey("PosNoId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionPath", "Position")
.WithMany()
.HasForeignKey("PositionId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
.WithMany()
.HasForeignKey("PositionLevelId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionType", "PositionType")
.WithMany()
.HasForeignKey("PositionTypeId");
b.HasOne("BMA.EHR.Domain.Models.MetaData.Prefix", "Prefix")
.WithMany()
.HasForeignKey("PrefixId");
b.Navigation("Avatar");
b.Navigation("Gender");
b.Navigation("LimitLeave");
b.Navigation("PosNo");
b.Navigation("Position");
b.Navigation("PositionLevel");
b.Navigation("PositionType");
b.Navigation("Prefix");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileAbility", b =>
@ -10603,10 +10767,16 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileInsignia", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.Insignia", "Insignia")
.WithMany()
.HasForeignKey("InsigniaId");
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
.WithMany("Insignias")
.HasForeignKey("ProfileId");
b.Navigation("Insignia");
b.Navigation("Profile");
});
@ -10728,10 +10898,16 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.HR.ProfileSalary", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.PositionLevel", "PositionLevel")
.WithMany()
.HasForeignKey("PositionLevelId");
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
.WithMany("Salaries")
.HasForeignKey("ProfileId");
b.Navigation("PositionLevel");
b.Navigation("Profile");
});
@ -10775,9 +10951,9 @@ namespace BMA.EHR.Infrastructure.Migrations
modelBuilder.Entity("BMA.EHR.Domain.Models.Insignias.InsigniaRequest", b =>
{
b.HasOne("BMA.EHR.Domain.Models.MetaData.OrganizationOrganization", "OrganizationOrganization")
b.HasOne("BMA.EHR.Domain.Models.Organizations.OrganizationEntity", "Organization")
.WithMany()
.HasForeignKey("OrganizationOrganizationId")
.HasForeignKey("OrganizationId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
@ -10787,7 +10963,7 @@ namespace BMA.EHR.Infrastructure.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OrganizationOrganization");
b.Navigation("Organization");
b.Navigation("Period");
});
@ -11374,6 +11550,25 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("Religion");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementProfile", b =>
{
b.HasOne("BMA.EHR.Domain.Models.HR.Profile", "Profile")
.WithMany()
.HasForeignKey("ProfileId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", "RetirementPeriod")
.WithMany("RetirementProfiles")
.HasForeignKey("RetirementPeriodId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Profile");
b.Navigation("RetirementPeriod");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Commands.Core.Command", b =>
{
b.Navigation("Documents");
@ -11574,6 +11769,11 @@ namespace BMA.EHR.Infrastructure.Migrations
b.Navigation("PlacementEducations");
});
modelBuilder.Entity("BMA.EHR.Domain.Models.Retirement.RetirementPeriod", b =>
{
b.Navigation("RetirementProfiles");
});
#pragma warning restore 612, 618
}
}

View file

@ -11,6 +11,7 @@ using Microsoft.EntityFrameworkCore;
using BMA.EHR.Domain.Models.Commands.Core;
using BMA.EHR.Domain.Models.Commands;
using BMA.EHR.Domain.Models.Insignias;
using BMA.EHR.Domain.Models.Retirement;
namespace BMA.EHR.Infrastructure.Persistence
{
@ -292,6 +293,14 @@ namespace BMA.EHR.Infrastructure.Persistence
#endregion
#region " Retirement "
public DbSet<RetirementPeriod> RetirementPeriods { get; set; }
public DbSet<RetirementProfile> RetirementProfiles { get; set; }
#endregion
public ApplicationDBContext(DbContextOptions<ApplicationDBContext> options) : base(options)
{
}