589 lines
42 KiB
C#
589 lines
42 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class addtableDisciplineDisciplinary : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineInvestigate_Profiles");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigateRelevant_Docs",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Docs",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_DocComplaints",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.AddColumn<Guid>(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Directors",
|
|
type: "char(36)",
|
|
nullable: true,
|
|
collation: "ascii_general_ci");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDisciplinary_DirectorInvestigates",
|
|
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"),
|
|
DisciplineDirectorId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDisciplinary_DirectorInvestigates", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DirectorInvestigates_DisciplineDirect~",
|
|
column: x => x.DisciplineDirectorId,
|
|
principalTable: "DisciplineDirectors",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DirectorInvestigates_DisciplineInvest~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDisciplinary_DocComplaintInvestigates",
|
|
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"),
|
|
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDisciplinary_DocComplaintInvestigates", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DocComplaintInvestigates_DisciplineIn~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DocComplaintInvestigates_Documents_Do~",
|
|
column: x => x.DocumentId,
|
|
principalTable: "Documents",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDisciplinary_DocInvestigateRelevants",
|
|
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"),
|
|
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDisciplinary_DocInvestigateRelevants", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DocInvestigateRelevants_DisciplineInv~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DocInvestigateRelevants_Documents_Doc~",
|
|
column: x => x.DocumentId,
|
|
principalTable: "Documents",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDisciplinary_DocInvestigates",
|
|
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"),
|
|
DocumentId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDisciplinary_DocInvestigates", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DocInvestigates_DisciplineInvestigate~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_DocInvestigates_Documents_DocumentId",
|
|
column: x => x.DocumentId,
|
|
principalTable: "Documents",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDisciplinary_ProfileComplaintInvestigates",
|
|
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"),
|
|
PersonId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "id อ้างอิง profile", collation: "ascii_general_ci"),
|
|
CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Organization = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Position = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PosNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PositionLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Salary = table.Column<double>(type: "double", nullable: true, comment: "เงินเดือน"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDisciplinary_ProfileComplaintInvestigates", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinary_ProfileComplaintInvestigates_Discipli~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDisciplinarys",
|
|
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"),
|
|
Status = table.Column<string>(type: "longtext", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
RespondentType = table.Column<string>(type: "longtext", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Title = table.Column<string>(type: "text", nullable: false, comment: "เรื่องที่ร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Description = table.Column<string>(type: "text", nullable: false, comment: "รายละเอียดของเรื่องร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
DateReceived = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
|
|
LevelConsideration = table.Column<string>(type: "longtext", nullable: false, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
DateConsideration = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
|
|
OffenseDetails = table.Column<string>(type: "longtext", nullable: false, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
DateNotification = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "วันแจ้งเตือนล่วงหน้า"),
|
|
ComplaintFrom = table.Column<string>(type: "longtext", nullable: false, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Appellant = table.Column<string>(type: "longtext", nullable: false, comment: "ผู้ร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
ResultComplaint = table.Column<string>(type: "longtext", nullable: true, comment: "ผลการตรวจสอบเรื่องร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Result = table.Column<string>(type: "longtext", nullable: true, comment: "ผลการตรวจสอบ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Organization = table.Column<Guid>(type: "char(36)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน", collation: "ascii_general_ci"),
|
|
ConsideredAgency = table.Column<Guid>(type: "char(36)", nullable: false, comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง", collation: "ascii_general_ci"),
|
|
InvestigationDetail = table.Column<string>(type: "longtext", nullable: true, comment: "ลักษณะการสืบสวน (appoint_directors คือ แต่งตั้งกรรมการสืบสวน, secret_investigation คือ สืบสวนทางลับ, other คือ อื่น ๆ)")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
InvestigationDetailOther = table.Column<string>(type: "longtext", nullable: true, comment: "ลักษณะการสืบสวนกรณีเลือกอื่นๆ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
InvestigationDateStart = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่เริ่มการสอบสวน"),
|
|
InvestigationDateEnd = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "วันที่สิ้นสุดการสอบสวน"),
|
|
InvestigationDescription = table.Column<string>(type: "longtext", nullable: true, comment: "รายละเอียดเกี่ยวกับการสืบสวน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
InvestigationStatusResult = table.Column<string>(type: "longtext", nullable: true, comment: "สถานะหรือผลการสืบสวน (not_specified คือ ยังไม่ระบุ, have_cause คือ มีมูล, no_cause คือ ไม่มีมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
InvestigationCauseText = table.Column<string>(type: "longtext", nullable: true, comment: "กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
DisciplineComplaintId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDisciplinarys", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineDisciplinarys_DisciplineComplaints_DisciplineCompl~",
|
|
column: x => x.DisciplineComplaintId,
|
|
principalTable: "DisciplineComplaints",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineInvestigate_ProfileComplaints",
|
|
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"),
|
|
PersonId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "id อ้างอิง profile", collation: "ascii_general_ci"),
|
|
CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Organization = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Position = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PosNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PositionLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Salary = table.Column<double>(type: "double", nullable: true, comment: "เงินเดือน"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
DisciplineDisciplinaryId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineInvestigate_ProfileComplaints", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineInvestigate_ProfileComplaints_DisciplineDisciplina~",
|
|
column: x => x.DisciplineDisciplinaryId,
|
|
principalTable: "DisciplineDisciplinarys",
|
|
principalColumn: "Id");
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineInvestigate_ProfileComplaints_DisciplineInvestigat~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigateRelevant_Docs_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigateRelevant_Docs",
|
|
column: "DisciplineDisciplinaryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigate_Docs_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Docs",
|
|
column: "DisciplineDisciplinaryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigate_DocComplaints_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_DocComplaints",
|
|
column: "DisciplineDisciplinaryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigate_Directors_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Directors",
|
|
column: "DisciplineDisciplinaryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DirectorInvestigates_DisciplineDirect~",
|
|
table: "DisciplineDisciplinary_DirectorInvestigates",
|
|
column: "DisciplineDirectorId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DirectorInvestigates_DisciplineInvest~",
|
|
table: "DisciplineDisciplinary_DirectorInvestigates",
|
|
column: "DisciplineInvestigateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DocComplaintInvestigates_DisciplineIn~",
|
|
table: "DisciplineDisciplinary_DocComplaintInvestigates",
|
|
column: "DisciplineInvestigateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DocComplaintInvestigates_DocumentId",
|
|
table: "DisciplineDisciplinary_DocComplaintInvestigates",
|
|
column: "DocumentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DocInvestigateRelevants_DisciplineInv~",
|
|
table: "DisciplineDisciplinary_DocInvestigateRelevants",
|
|
column: "DisciplineInvestigateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DocInvestigateRelevants_DocumentId",
|
|
table: "DisciplineDisciplinary_DocInvestigateRelevants",
|
|
column: "DocumentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DocInvestigates_DisciplineInvestigate~",
|
|
table: "DisciplineDisciplinary_DocInvestigates",
|
|
column: "DisciplineInvestigateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_DocInvestigates_DocumentId",
|
|
table: "DisciplineDisciplinary_DocInvestigates",
|
|
column: "DocumentId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinary_ProfileComplaintInvestigates_Discipli~",
|
|
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
|
|
column: "DisciplineInvestigateId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineDisciplinarys_DisciplineComplaintId",
|
|
table: "DisciplineDisciplinarys",
|
|
column: "DisciplineComplaintId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigate_ProfileComplaints_DisciplineDisciplina~",
|
|
table: "DisciplineInvestigate_ProfileComplaints",
|
|
column: "DisciplineDisciplinaryId");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigate_ProfileComplaints_DisciplineInvestigat~",
|
|
table: "DisciplineInvestigate_ProfileComplaints",
|
|
column: "DisciplineInvestigateId");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_DisciplineInvestigate_Directors_DisciplineDisciplinarys_Disc~",
|
|
table: "DisciplineInvestigate_Directors",
|
|
column: "DisciplineDisciplinaryId",
|
|
principalTable: "DisciplineDisciplinarys",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_DisciplineInvestigate_DocComplaints_DisciplineDisciplinarys_~",
|
|
table: "DisciplineInvestigate_DocComplaints",
|
|
column: "DisciplineDisciplinaryId",
|
|
principalTable: "DisciplineDisciplinarys",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_DisciplineInvestigate_Docs_DisciplineDisciplinarys_Disciplin~",
|
|
table: "DisciplineInvestigate_Docs",
|
|
column: "DisciplineDisciplinaryId",
|
|
principalTable: "DisciplineDisciplinarys",
|
|
principalColumn: "Id");
|
|
|
|
migrationBuilder.AddForeignKey(
|
|
name: "FK_DisciplineInvestigateRelevant_Docs_DisciplineDisciplinarys_D~",
|
|
table: "DisciplineInvestigateRelevant_Docs",
|
|
column: "DisciplineDisciplinaryId",
|
|
principalTable: "DisciplineDisciplinarys",
|
|
principalColumn: "Id");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_DisciplineInvestigate_Directors_DisciplineDisciplinarys_Disc~",
|
|
table: "DisciplineInvestigate_Directors");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_DisciplineInvestigate_DocComplaints_DisciplineDisciplinarys_~",
|
|
table: "DisciplineInvestigate_DocComplaints");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_DisciplineInvestigate_Docs_DisciplineDisciplinarys_Disciplin~",
|
|
table: "DisciplineInvestigate_Docs");
|
|
|
|
migrationBuilder.DropForeignKey(
|
|
name: "FK_DisciplineInvestigateRelevant_Docs_DisciplineDisciplinarys_D~",
|
|
table: "DisciplineInvestigateRelevant_Docs");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDisciplinary_DirectorInvestigates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDisciplinary_DocComplaintInvestigates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDisciplinary_DocInvestigateRelevants");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDisciplinary_DocInvestigates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDisciplinary_ProfileComplaintInvestigates");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineInvestigate_ProfileComplaints");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDisciplinarys");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DisciplineInvestigateRelevant_Docs_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigateRelevant_Docs");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DisciplineInvestigate_Docs_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Docs");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DisciplineInvestigate_DocComplaints_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_DocComplaints");
|
|
|
|
migrationBuilder.DropIndex(
|
|
name: "IX_DisciplineInvestigate_Directors_DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Directors");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigateRelevant_Docs");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Docs");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_DocComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DisciplineDisciplinaryId",
|
|
table: "DisciplineInvestigate_Directors");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineInvestigate_Profiles",
|
|
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"),
|
|
DisciplineInvestigateId = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
|
|
CitizenId = table.Column<string>(type: "varchar(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FirstName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "ชื่อ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastName = table.Column<string>(type: "varchar(100)", maxLength: 100, nullable: false, comment: "นามสกุล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Organization = table.Column<string>(type: "longtext", nullable: true, comment: "สังกัด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PersonId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "id อ้างอิง profile", collation: "ascii_general_ci"),
|
|
PosNo = table.Column<string>(type: "longtext", nullable: true, comment: "เลขที่ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Position = table.Column<string>(type: "longtext", nullable: true, comment: "ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
PositionLevel = table.Column<string>(type: "longtext", nullable: true, comment: "ระดับ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Prefix = table.Column<string>(type: "longtext", nullable: true, comment: "คำนำหน้า")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Salary = table.Column<double>(type: "double", nullable: true, comment: "เงินเดือน")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineInvestigate_Profiles", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_DisciplineInvestigate_Profiles_DisciplineInvestigates_Discip~",
|
|
column: x => x.DisciplineInvestigateId,
|
|
principalTable: "DisciplineInvestigates",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_DisciplineInvestigate_Profiles_DisciplineInvestigateId",
|
|
table: "DisciplineInvestigate_Profiles",
|
|
column: "DisciplineInvestigateId");
|
|
}
|
|
}
|
|
}
|