using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
{
///
public partial class InitOracleProject : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "DisciplineComplaint_Appeals",
columns: table => new
{
Id = table.Column(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะอุทธรณ์/ร้องทุกข์"),
Title = table.Column(type: "NCLOB", nullable: true, comment: "เรื่องที่อุทธรณ์/ร้องทุกข์"),
Description = table.Column(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องอุทธรณ์/ร้องทุกข์"),
Type = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ประเภทอุทธรณ์หรือร้องทุกข์"),
Year = table.Column(type: "NUMBER(10)", nullable: true, comment: "ปีงบประมาณ"),
CaseType = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ประเภทคดี"),
CaseNumber = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "คดีเลขที่"),
ProfileId = table.Column(type: "RAW(16)", nullable: false, comment: "ProfileId"),
CitizenId = table.Column(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Fullname = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ชื่อ-นามสกุลผู้อุทธรณ์/ร้องทุกข์"),
Position = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่งผู้อุทธรณ์/ร้องทุกข์"),
Oc = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Name = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"),
RespondentType = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"),
Title = table.Column(type: "NCLOB", nullable: false, comment: "เรื่องที่ร้องเรียน"),
Description = table.Column(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องร้องเรียน"),
DateReceived = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
LevelConsideration = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"),
DateConsideration = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
OffenseDetails = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DateNotification = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันแจ้งเตือนล่วงหน้า"),
ComplaintFrom = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"),
Appellant = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผู้ร้องเรียน"),
Result = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบ"),
Organization = table.Column(type: "RAW(16)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน"),
ConsideredAgency = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Prefix = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "คำนำหน้าชื่อ"),
FirstName = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อ"),
LastName = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "นามสกุล"),
Position = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ตำแหน่ง"),
Email = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "อีเมล"),
Phone = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เบอร์โทรศัพท์"),
Qualification = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column(type: "RAW(16)", nullable: false),
DisciplineComplaint_AppealId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะอุทธรณ์/ร้องทุกข์"),
DisciplineComplaint_AppealId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column(type: "RAW(16)", nullable: false),
DisciplineComplaintId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
PersonId = table.Column(type: "RAW(16)", nullable: true, comment: "id อ้างอิง profile"),
CitizenId = table.Column(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Prefix = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "คำนำหน้า"),
FirstName = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "ชื่อ"),
LastName = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "นามสกุล"),
Organization = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัด"),
Position = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่ง"),
PosNo = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่ตำแหน่ง"),
PositionLevel = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับ"),
Salary = table.Column(type: "BINARY_DOUBLE", nullable: true, comment: "เงินเดือน"),
IsAncestorDNA = table.Column(type: "NUMBER(1)", nullable: true, comment: "รายการเก่า"),
DisciplineComplaintId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"),
RespondentType = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"),
Title = table.Column(type: "NCLOB", nullable: false, comment: "เรื่องที่ร้องเรียน"),
Description = table.Column(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องร้องเรียน"),
DateReceived = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
LevelConsideration = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"),
DateConsideration = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
OffenseDetails = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DateNotification = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันแจ้งเตือนล่วงหน้า"),
ComplaintFrom = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"),
Appellant = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผู้ร้องเรียน"),
ResultComplaint = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบเรื่องร้องเรียน"),
Result = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบ"),
Organization = table.Column(type: "RAW(16)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน"),
ConsideredAgency = table.Column(type: "RAW(16)", nullable: false, comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"),
InvestigationDetail = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวน (appoint_directors คือ แต่งตั้งกรรมการสืบสวน, secret_investigation คือ สืบสวนทางลับ, other คือ อื่น ๆ)"),
InvestigationDetailOther = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวนกรณีเลือกอื่นๆ"),
InvestigationDateStart = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่มการสืบสวน"),
InvestigationDateEnd = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุดการสืบสวน"),
InvestigationDescription = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "รายละเอียดเกี่ยวกับการสืบสวน"),
InvestigationStatusResult = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะหรือผลการสืบสวน (not_specified คือ ยังไม่ระบุ, have_cause คือ มีมูล, no_cause คือ ไม่มีมูล"),
InvestigationCauseText = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"),
InvestigationExtendStatus = table.Column(type: "NUMBER(1)", nullable: false, comment: "ขยายเวลา"),
InvestigationDaysExtend = table.Column(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่ต้องการขยาย"),
DisciplineComplaintId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Status = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)"),
RespondentType = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)"),
Title = table.Column(type: "NCLOB", nullable: false, comment: "เรื่องที่ร้องเรียน"),
Description = table.Column(type: "NCLOB", nullable: true, comment: "รายละเอียดของเรื่องร้องเรียน"),
DateReceived = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ"),
LevelConsideration = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)"),
DateConsideration = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่กำหนดพิจารณา"),
OffenseDetails = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)"),
DateNotification = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันแจ้งเตือนล่วงหน้า"),
ComplaintFrom = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)"),
Appellant = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผู้ร้องเรียน"),
ResultComplaint = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบเรื่องร้องเรียน"),
ResultInvestigate = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบเรื่องสืบสวน"),
Result = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการตรวจสอบ"),
Organization = table.Column(type: "RAW(16)", nullable: true, comment: "กรณีหน่วยงานใส่ id ของหน่วยงาน"),
ConsideredAgency = table.Column(type: "RAW(16)", nullable: false, comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง"),
InvestigationDetail = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวน (APPOINT_DIRECTORS คือ แต่งตั้งกรรมการสืบสวน, SECRET_INVESTIGATION คือ สืบสวนทางลับ, OTHER คือ อื่น ๆ)"),
InvestigationDetailOther = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ลักษณะการสืบสวนกรณีเลือกอื่นๆ"),
InvestigationDateStart = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่มการสืบสวน"),
InvestigationDateEnd = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุดการสืบสวน"),
InvestigationDescription = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "รายละเอียดเกี่ยวกับการสืบสวน"),
InvestigationStatusResult = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะหรือผลการสืบสวน (NOT_SPECIFIED คือ ยังไม่ระบุ, HAVE_CAUSE คือ มีมูล, NO_CAUSE คือ ไม่มีมูล"),
InvestigationCauseText = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีมีมูลต้องเลือกว่า 'ร้ายแรง' หรือ 'ไม่ร้ายแรง'"),
InvestigationExtendStatus = table.Column(type: "NUMBER(1)", nullable: false, comment: "ขยายเวลา"),
InvestigationDaysExtend = table.Column(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่ต้องการขยาย"),
DisciplinaryWitnesses = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "พยานและบันทึกถ้อยคำพยาน"),
DisciplinaryRecordAccuser = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "บันทึกถ้อยคำของผู้กล่าวหา"),
DisciplinarySummaryEvidence = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สรุปพยานหลักฐานสนับสนุนข้อกล่าวหา"),
DisciplinaryRefLaw = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "อ้างอิงมาตราตามกฎหมาย"),
DisciplinaryFaultLevel = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับโทษความผิด กรณีไม่ร้ายแรง: ภาคทัณฑ์, ตัดเงินเดือน, ลดขั้นเงินเดือน | กรณีร้ายแรง: ปลดออก, ไล่ออก"),
DisciplinaryInvestigateAt = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สอบสวนที่"),
DisciplinaryCaseFault = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีความผิด"),
DisciplinaryDateEvident = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สรุปพยานหลักฐาน"),
DisciplinaryDateAllegation = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รับทราบข้อกล่าวหา"),
DisciplinaryDateStart = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่เริ่มการสอบสวน"),
DisciplinaryDateEnd = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่สิ้นสุดการสอบสวน"),
DisciplinaryDaysExtend = table.Column(type: "NUMBER(10)", nullable: true, comment: "จำนวนวันที่ขยาย"),
DisciplinaryExtendStatus = table.Column(type: "NUMBER(1)", nullable: false, comment: "ขยายเวลา"),
DisciplinaryDateInvestigation = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่มีคำสั่งให้สอบสวน"),
DisciplinaryDateResult = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่รายงานผลการสอบสวน"),
DisciplinaryStatusResult = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการสอบสวน ผล"),
DisciplinaryCauseText = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการสอบสวน กรณีมีมูล"),
DisciplinaryResult = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ผลการสอบสวน เหตุผล"),
ResultDescription = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สรุปผลการพิจารณา"),
ResultOc = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "หน่วยงาย/ส่วนราชการ"),
ResultDisciplineType = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ประเภทวินัย"),
ResultTitleType = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ประเภทของเรื่อง"),
ResultYear = table.Column(type: "NUMBER(10)", nullable: true, comment: "ปีงบประมาณ"),
DisciplinaryFaultLevelOther = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับโทษความผิดกรณีอื่นๆ"),
DisciplineInvestigateId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DisciplineDirectorId = table.Column(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column(type: "RAW(16)", nullable: false),
Duty = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "หน้าที่"),
CommandNo = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
DocumentId = table.Column(type: "RAW(16)", nullable: false),
DisciplineInvestigateId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
PersonId = table.Column(type: "RAW(16)", nullable: true, comment: "id อ้างอิง profile"),
CitizenId = table.Column(type: "NVARCHAR2(13)", maxLength: 13, nullable: true, comment: "รหัสบัตรประชาชน"),
Prefix = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "คำนำหน้า"),
FirstName = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "ชื่อ"),
LastName = table.Column(type: "NVARCHAR2(100)", maxLength: 100, nullable: false, comment: "นามสกุล"),
Organization = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัด"),
Position = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่ง"),
PosNo = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เลขที่ตำแหน่ง"),
PositionLevel = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับ"),
Salary = table.Column(type: "BINARY_DOUBLE", nullable: true, comment: "เงินเดือน"),
IsReport = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ส่งไปยุติเรื่อง"),
IsDisciplinary = table.Column(type: "NUMBER(1)", nullable: true, comment: "ส่งไปสอบสวน"),
IsAncestorDNA = table.Column(type: "NUMBER(1)", nullable: true, comment: "รายการเก่า"),
DisciplineInvestigateId = table.Column(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(type: "RAW(16)", nullable: false, comment: "PrimaryKey"),
CreatedAt = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
CreatedUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล"),
LastUpdatedAt = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
LastUpdateUserId = table.Column(type: "NVARCHAR2(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด"),
CreatedFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล"),
LastUpdateFullName = table.Column(type: "NVARCHAR2(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด"),
Name = table.Column