hrms-api-backend/BMA.EHR.Infrastructure/Migrations/DisciplineDb/20240503071644_Init Oracle Project.cs
2024-05-03 14:17:30 +07:00

1273 lines
109 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
/// <inheritdoc />
public partial class InitOracleProject : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Appeals",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะอุทธรณ์/ร้องทุกข์"),
Title = table.Column<string>(type: "NCLOB", nullable: true, comment: "เรื่องที่อุทธรณ์/ร้องทุกข์"),
Description = table.Column<string>(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์"),
Type = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ประเภทอุทธรณ์หรือร้องทุกข์"),
Year = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "ปีงบประมาณ"),
CaseType = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ประเภทคดี"),
CaseNumber = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "คดีเลขที่"),
ProfileId = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "ProfileId"),
CitizenId = table.Column<string>(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Fullname = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์"),
Position = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่งผู้อุทธรณ์/ร้องทุกข์"),
Oc = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัดผู้อุทธรณ์/ร้องทุกข์")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Appeals", x => x.Id);
});
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Channels",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Name = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อประเภทการร้องเรียน")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Channels", x => x.Id);
});
migrationBuilder.CreateTable(
name: "DisciplineComplaints",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"),
RespondentType = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"),
Title = table.Column<string>(type: "NCLOB", nullable: false, comment: "เรื่องที่ร้องเรียน"),
Description = table.Column<string>(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องร้องเรียน"),
DateReceived = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
LevelConsideration = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"),
DateConsideration = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
OffenseDetails = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DateNotification = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันแจ้งเตือนล่วงหน้า"),
ComplaintFrom = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"),
Appellant = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผู้ร้องเรียน"),
Result = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบ"),
Organization = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน"),
ConsideredAgency = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaints", x => x.Id);
});
migrationBuilder.CreateTable(
name: "DisciplineDirectors",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Prefix = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "คำนำหน้าชื่อ"),
FirstName = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อ"),
LastName = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "นามสกุล"),
Position = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ตำแหน่ง"),
Email = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "อีเมล"),
Phone = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เบอร์โทรศัพท์"),
Qualification = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "คุณวุฒิ")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDirectors", x => x.Id);
});
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Appeal_Docs",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineComplaint_AppealId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Appeal_Docs", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineComplaint_Appeal_Docs_DisciplineComplaint_Appeals_DisciplineComplaint_AppealId",
column: x => x.DisciplineComplaint_AppealId,
principalTable: "DisciplineComplaint_Appeals",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineComplaint_Appeal_Docs_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Appeal_Historys",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะอุทธรณ์/ร้องทุกข์"),
DisciplineComplaint_AppealId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Appeal_Historys", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineComplaint_Appeal_Historys_DisciplineComplaint_Appeals_DisciplineComplaint_AppealId",
column: x => x.DisciplineComplaint_AppealId,
principalTable: "DisciplineComplaint_Appeals",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Docs",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineComplaintId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Docs", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineComplaint_Docs_DisciplineComplaints_DisciplineComplaintId",
column: x => x.DisciplineComplaintId,
principalTable: "DisciplineComplaints",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineComplaint_Docs_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Profiles",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
PersonId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "id อ้างอิง profile"),
CitizenId = table.Column<string>(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Prefix = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "คำนำหน้า"),
FirstName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "ชื่อ"),
LastName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "นามสกุล"),
Organization = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัด"),
Position = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่ง"),
PosNo = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่ตำแหน่ง"),
PositionLevel = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับ"),
Salary = table.Column<double>(type: "BINARY_DOUBLE", nullable: true, comment: "เงินเดือน"),
IsAncestorDNA = table.Column<bool>(type: "NUMBER(1)", nullable: true, comment: "รายการเก่า"),
DisciplineComplaintId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineComplaint_Profiles", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineComplaint_Profiles_DisciplineComplaints_DisciplineComplaintId",
column: x => x.DisciplineComplaintId,
principalTable: "DisciplineComplaints",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigates",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"),
RespondentType = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"),
Title = table.Column<string>(type: "NCLOB", nullable: false, comment: "เรื่องที่ร้องเรียน"),
Description = table.Column<string>(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องร้องเรียน"),
DateReceived = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
LevelConsideration = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"),
DateConsideration = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
OffenseDetails = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DateNotification = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันแจ้งเตือนล่วงหน้า"),
ComplaintFrom = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"),
Appellant = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผู้ร้องเรียน"),
ResultComplaint = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบเรื่องร้องเรียน"),
Result = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบ"),
Organization = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน"),
ConsideredAgency = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"),
InvestigationDetail = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวน (appoint_directors คือ แต่งตั้งกรรมการสืบสวน, secret_investigation คือ สืบสวนทางลับ, other คือ อื่น ๆ)"),
InvestigationDetailOther = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวนกรณีเลือกอื่นๆ"),
InvestigationDateStart = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่มการสืบสวน"),
InvestigationDateEnd = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุดการสืบสวน"),
InvestigationDescription = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "รายละเอียดเกี่ยวกับการสืบสวน"),
InvestigationStatusResult = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะหรือผลการสืบสวน (not_specified คือ ยังไม่ระบุ, have_cause คือ มีมูล, no_cause คือ ไม่มีมูล"),
InvestigationCauseText = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"),
InvestigationExtendStatus = table.Column<bool>(type: "NUMBER(1)", nullable: false, comment: "ขยายเวลา"),
InvestigationDaysExtend = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่ต้องการขยาย"),
DisciplineComplaintId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigates", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigates_DisciplineComplaints_DisciplineComplaintId",
column: x => x.DisciplineComplaintId,
principalTable: "DisciplineComplaints",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinarys",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"),
RespondentType = table.Column<string>(type: "NVARCHAR2(2000)", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"),
Title = table.Column<string>(type: "NCLOB", nullable: false, comment: "เรื่องที่ร้องเรียน"),
Description = table.Column<string>(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องร้องเรียน"),
DateReceived = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
LevelConsideration = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"),
DateConsideration = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
OffenseDetails = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DateNotification = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันแจ้งเตือนล่วงหน้า"),
ComplaintFrom = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"),
Appellant = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผู้ร้องเรียน"),
ResultComplaint = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบเรื่องร้องเรียน"),
ResultInvestigate = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบเรื่องสืบสวน"),
Result = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบ"),
Organization = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน"),
ConsideredAgency = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"),
InvestigationDetail = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวน (APPOINT_DIRECTORS คือ แต่งตั้งกรรมการสืบสวน, SECRET_INVESTIGATION คือ สืบสวนทางลับ, OTHER คือ อื่น ๆ)"),
InvestigationDetailOther = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวนกรณีเลือกอื่นๆ"),
InvestigationDateStart = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่มการสืบสวน"),
InvestigationDateEnd = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุดการสืบสวน"),
InvestigationDescription = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "รายละเอียดเกี่ยวกับการสืบสวน"),
InvestigationStatusResult = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะหรือผลการสืบสวน (NOT_SPECIFIED คือ ยังไม่ระบุ, HAVE_CAUSE คือ มีมูล, NO_CAUSE คือ ไม่มีมูล"),
InvestigationCauseText = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"),
InvestigationExtendStatus = table.Column<bool>(type: "NUMBER(1)", nullable: false, comment: "ขยายเวลา"),
InvestigationDaysExtend = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่ต้องการขยาย"),
DisciplinaryWitnesses = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "พยานและบันทึกถ้อยคำพยาน"),
DisciplinaryRecordAccuser = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "บันทึกถ้อยคำของผู้กล่าวหา"),
DisciplinarySummaryEvidence = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สรุปพยานหลักฐานสนับสนุนข้อกล่าวหา"),
DisciplinaryRefLaw = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "อ้างอิงมาตราตามกฎหมาย"),
DisciplinaryFaultLevel = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"),
DisciplinaryInvestigateAt = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สอบสวนที่"),
DisciplinaryCaseFault = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีความผิด"),
DisciplinaryDateEvident = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สรุปพยานหลักฐาน"),
DisciplinaryDateAllegation = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับทราบข้อกล่าวหา"),
DisciplinaryDateStart = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่มการสอบสวน"),
DisciplinaryDateEnd = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุดการสอบสวน"),
DisciplinaryDaysExtend = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่ขยาย"),
DisciplinaryExtendStatus = table.Column<bool>(type: "NUMBER(1)", nullable: false, comment: "ขยายเวลา"),
DisciplinaryDateInvestigation = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่มีคำสั่งให้สอบสวน"),
DisciplinaryDateResult = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รายงานผลการสอบสวน"),
DisciplinaryStatusResult = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการสอบสวน ผล"),
DisciplinaryCauseText = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการสอบสวน กรณีมีมูล"),
DisciplinaryResult = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการสอบสวน เหตุผล"),
ResultDescription = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สรุปผลการพิจารณา"),
ResultOc = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "หน่วยงาย/ส่วนราชการ"),
ResultDisciplineType = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ประเภทวินัย"),
ResultTitleType = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ประเภทของเรื่อง"),
ResultYear = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "ปีงบประมาณ"),
DisciplinaryFaultLevelOther = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับโทษความผิดกรณีอื่นๆ"),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinarys", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinarys_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigate_Directors",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DisciplineDirectorId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false),
Duty = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "หน้าที่"),
CommandNo = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่คำสั่ง")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigate_Directors", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigate_Directors_DisciplineDirectors_DisciplineDirectorId",
column: x => x.DisciplineDirectorId,
principalTable: "DisciplineDirectors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineInvestigate_Directors_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigate_DocComplaints",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigate_DocComplaints", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigate_DocComplaints_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineInvestigate_DocComplaints_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigate_Docs",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigate_Docs", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigate_Docs_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineInvestigate_Docs_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigate_ProfileComplaints",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
PersonId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "id อ้างอิง profile"),
CitizenId = table.Column<string>(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Prefix = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "คำนำหน้า"),
FirstName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "ชื่อ"),
LastName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "นามสกุล"),
Organization = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัด"),
Position = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่ง"),
PosNo = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่ตำแหน่ง"),
PositionLevel = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับ"),
Salary = table.Column<double>(type: "BINARY_DOUBLE", nullable: true, comment: "เงินเดือน"),
IsReport = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ส่งไปยุติเรื่อง"),
IsDisciplinary = table.Column<bool>(type: "NUMBER(1)", nullable: true, comment: "ส่งไปสอบสวน"),
IsAncestorDNA = table.Column<bool>(type: "NUMBER(1)", nullable: true, comment: "รายการเก่า"),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigate_ProfileComplaints", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigate_ProfileComplaints_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigateExtends",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Name = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ชื่อการขยาย"),
Num = table.Column<int>(type: "NUMBER(10)", nullable: false, comment: "ครั้งที่ขยาย"),
DaysExtend = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่การขยาย"),
DateStart = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่ม"),
DateEnd = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุด"),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigateExtends", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigateExtends_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineInvestigateRelevant_Docs",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineInvestigateRelevant_Docs", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineInvestigateRelevant_Docs_DisciplineInvestigates_DisciplineInvestigateId",
column: x => x.DisciplineInvestigateId,
principalTable: "DisciplineInvestigates",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineInvestigateRelevant_Docs_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DirectorInvestigates",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DisciplineDirectorId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false),
Duty = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "หน้าที่"),
CommandNo = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่คำสั่ง")
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DirectorInvestigates", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DirectorInvestigates_DisciplineDirectors_DisciplineDirectorId",
column: x => x.DisciplineDirectorId,
principalTable: "DisciplineDirectors",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DirectorInvestigates_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocComplaintInvestigates",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocComplaintInvestigates", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocComplaintInvestigates_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocComplaintInvestigates_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocInvestigateRelevants",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocInvestigateRelevants", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocInvestigateRelevants_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocInvestigateRelevants_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocInvestigates",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocInvestigates", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocInvestigates_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocInvestigates_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocOthers",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocOthers", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocOthers_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocOthers_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocRecordAccusers",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocRecordAccusers", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocRecordAccusers_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocRecordAccusers_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocRelevants",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocRelevants", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocRelevants_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocRelevants_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocResults",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocResults", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocResults_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocResults_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocSummaryEvidences",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocSummaryEvidences", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocSummaryEvidences_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocSummaryEvidences_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_DocWitnessess",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column<Guid>(type: "RAW(16)", nullable: false),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_DocWitnessess", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocWitnessess_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_DocWitnessess_Documents_DocumentId",
column: x => x.DocumentId,
principalTable: "Documents",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinary_ProfileComplaintInvestigates",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
PersonId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "id อ้างอิง profile"),
CitizenId = table.Column<string>(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Prefix = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "คำนำหน้า"),
FirstName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "ชื่อ"),
LastName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "นามสกุล"),
Organization = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัด"),
Position = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่ง"),
PosNo = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่ตำแหน่ง"),
PositionLevel = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับ"),
Salary = table.Column<double>(type: "BINARY_DOUBLE", nullable: true, comment: "เงินเดือน"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะออกคำสั่ง"),
CommandTypeId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "ประเภทออกคำสั่ง"),
StatusDiscard = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะออกคำสั่งงดโทด"),
CommandTypeDiscardId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "ประเภทออกคำสั่งงดโทด"),
IsReport = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ส่งไปยุติเรื่อง"),
IsSuspend = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ส่งไปพักราชการ"),
IsAncestorDNA = table.Column<bool>(type: "NUMBER(1)", nullable: true, comment: "รายการเก่า"),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinary_ProfileComplaintInvestigates", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinary_ProfileComplaintInvestigates_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineDisciplinaryExtends",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Name = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ชื่อการขยาย"),
Num = table.Column<int>(type: "NUMBER(10)", nullable: false, comment: "ครั้งที่ขยาย"),
DaysExtend = table.Column<int>(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่การขยาย"),
DateStart = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่ม"),
DateEnd = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุด"),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineDisciplinaryExtends", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineDisciplinaryExtends_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "DisciplineReport_Profiles",
columns: table => new
{
Id = table.Column<Guid>(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column<string>(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column<string>(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
PersonId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "id อ้างอิง profile"),
CitizenId = table.Column<string>(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Prefix = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "คำนำหน้า"),
FirstName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "ชื่อ"),
LastName = table.Column<string>(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "นามสกุล"),
Organization = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัด"),
Position = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่ง"),
PosNo = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่ตำแหน่ง"),
PositionLevel = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับ"),
Salary = table.Column<double>(type: "BINARY_DOUBLE", nullable: true, comment: "เงินเดือน"),
Status = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะออกคำสั่ง"),
CommandTypeId = table.Column<Guid>(type: "RAW(16)", nullable: true, comment: "ประเภทออกคำสั่ง"),
DescriptionSuspend = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "เหตุที่ถูกสั่งพักราชการ/ออกจากราชการไว้ก่อน"),
StartDateSuspend = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"),
EndDateSuspend = table.Column<DateTime>(type: "TIMESTAMP(7)", nullable: true, comment: "วันสิ้นสุดการสั่งพักราชการ/ให้ออกจากราชการไว้ก่อน"),
Title = table.Column<string>(type: "NCLOB", nullable: true, comment: "เรื่องที่ร้องเรียน"),
OffenseDetails = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DisciplinaryFaultLevel = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"),
DisciplinaryCaseFault = table.Column<string>(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีความผิด"),
DisciplineDisciplinaryId = table.Column<Guid>(type: "RAW(16)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_DisciplineReport_Profiles", x => x.Id);
table.ForeignKey(
name: "FK_DisciplineReport_Profiles_DisciplineDisciplinarys_DisciplineDisciplinaryId",
column: x => x.DisciplineDisciplinaryId,
principalTable: "DisciplineDisciplinarys",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Appeal_Docs_DisciplineComplaint_AppealId",
table: "DisciplineComplaint_Appeal_Docs",
column: "DisciplineComplaint_AppealId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Appeal_Docs_DocumentId",
table: "DisciplineComplaint_Appeal_Docs",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Appeal_Historys_DisciplineComplaint_AppealId",
table: "DisciplineComplaint_Appeal_Historys",
column: "DisciplineComplaint_AppealId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Docs_DisciplineComplaintId",
table: "DisciplineComplaint_Docs",
column: "DisciplineComplaintId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Docs_DocumentId",
table: "DisciplineComplaint_Docs",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineComplaint_Profiles_DisciplineComplaintId",
table: "DisciplineComplaint_Profiles",
column: "DisciplineComplaintId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DirectorInvestigates_DisciplineDirectorId",
table: "DisciplineDisciplinary_DirectorInvestigates",
column: "DisciplineDirectorId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DirectorInvestigates_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DirectorInvestigates",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocComplaintInvestigates_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocComplaintInvestigates",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocComplaintInvestigates_DocumentId",
table: "DisciplineDisciplinary_DocComplaintInvestigates",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocInvestigateRelevants_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocInvestigateRelevants",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocInvestigateRelevants_DocumentId",
table: "DisciplineDisciplinary_DocInvestigateRelevants",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocInvestigates_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocInvestigates",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocInvestigates_DocumentId",
table: "DisciplineDisciplinary_DocInvestigates",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocOthers_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocOthers",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocOthers_DocumentId",
table: "DisciplineDisciplinary_DocOthers",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocRecordAccusers_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocRecordAccusers",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocRecordAccusers_DocumentId",
table: "DisciplineDisciplinary_DocRecordAccusers",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocRelevants_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocRelevants",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocRelevants_DocumentId",
table: "DisciplineDisciplinary_DocRelevants",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocResults_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocResults",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocResults_DocumentId",
table: "DisciplineDisciplinary_DocResults",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocSummaryEvidences_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocSummaryEvidences",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocSummaryEvidences_DocumentId",
table: "DisciplineDisciplinary_DocSummaryEvidences",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocWitnessess_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_DocWitnessess",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_DocWitnessess_DocumentId",
table: "DisciplineDisciplinary_DocWitnessess",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinary_ProfileComplaintInvestigates_DisciplineDisciplinaryId",
table: "DisciplineDisciplinary_ProfileComplaintInvestigates",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinaryExtends_DisciplineDisciplinaryId",
table: "DisciplineDisciplinaryExtends",
column: "DisciplineDisciplinaryId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineDisciplinarys_DisciplineInvestigateId",
table: "DisciplineDisciplinarys",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_Directors_DisciplineDirectorId",
table: "DisciplineInvestigate_Directors",
column: "DisciplineDirectorId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_Directors_DisciplineInvestigateId",
table: "DisciplineInvestigate_Directors",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_DocComplaints_DisciplineInvestigateId",
table: "DisciplineInvestigate_DocComplaints",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_DocComplaints_DocumentId",
table: "DisciplineInvestigate_DocComplaints",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_Docs_DisciplineInvestigateId",
table: "DisciplineInvestigate_Docs",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_Docs_DocumentId",
table: "DisciplineInvestigate_Docs",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigate_ProfileComplaints_DisciplineInvestigateId",
table: "DisciplineInvestigate_ProfileComplaints",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigateExtends_DisciplineInvestigateId",
table: "DisciplineInvestigateExtends",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigateRelevant_Docs_DisciplineInvestigateId",
table: "DisciplineInvestigateRelevant_Docs",
column: "DisciplineInvestigateId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigateRelevant_Docs_DocumentId",
table: "DisciplineInvestigateRelevant_Docs",
column: "DocumentId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineInvestigates_DisciplineComplaintId",
table: "DisciplineInvestigates",
column: "DisciplineComplaintId");
migrationBuilder.CreateIndex(
name: "IX_DisciplineReport_Profiles_DisciplineDisciplinaryId",
table: "DisciplineReport_Profiles",
column: "DisciplineDisciplinaryId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "DisciplineComplaint_Appeal_Docs");
migrationBuilder.DropTable(
name: "DisciplineComplaint_Appeal_Historys");
migrationBuilder.DropTable(
name: "DisciplineComplaint_Channels");
migrationBuilder.DropTable(
name: "DisciplineComplaint_Docs");
migrationBuilder.DropTable(
name: "DisciplineComplaint_Profiles");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DirectorInvestigates");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocComplaintInvestigates");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocInvestigateRelevants");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocInvestigates");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocOthers");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocRecordAccusers");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocRelevants");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocResults");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocSummaryEvidences");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_DocWitnessess");
migrationBuilder.DropTable(
name: "DisciplineDisciplinary_ProfileComplaintInvestigates");
migrationBuilder.DropTable(
name: "DisciplineDisciplinaryExtends");
migrationBuilder.DropTable(
name: "DisciplineInvestigate_Directors");
migrationBuilder.DropTable(
name: "DisciplineInvestigate_DocComplaints");
migrationBuilder.DropTable(
name: "DisciplineInvestigate_Docs");
migrationBuilder.DropTable(
name: "DisciplineInvestigate_ProfileComplaints");
migrationBuilder.DropTable(
name: "DisciplineInvestigateExtends");
migrationBuilder.DropTable(
name: "DisciplineInvestigateRelevant_Docs");
migrationBuilder.DropTable(
name: "DisciplineReport_Profiles");
migrationBuilder.DropTable(
name: "DisciplineComplaint_Appeals");
migrationBuilder.DropTable(
name: "DisciplineDirectors");
migrationBuilder.DropTable(
name: "DisciplineDisciplinarys");
migrationBuilder.DropTable(
name: "DisciplineInvestigates");
migrationBuilder.DropTable(
name: "DisciplineComplaints");
}
}
}