using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace BMA.EHR.Infrastructure.Migrations { /// public partial class InitOracleProject : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "AdditionalCheckRequests", 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 ที่แก้ไขข้อมูลล่าสุด"), CheckDate = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "*วันที่ลงเวลา"), CheckInEdit = table.Column(type: "NUMBER(1)", nullable: false, comment: "*ขอลงเวลาช่วงเช้า"), CheckOutEdit = table.Column(type: "NUMBER(1)", nullable: false, comment: "*ขอลงเวลาช่วงบ่าย"), Description = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "*หมายเหตุขอลงเวลาพิเศษ"), Status = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะการอนุมัติ"), Comment = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "หมายเหตุในการการอนุมัติ/ไม่อนุมัติ"), KeycloakUserId = table.Column(type: "RAW(16)", nullable: false, comment: "รหัส User ของ Keycloak ที่ร้องขอ") }, constraints: table => { table.PrimaryKey("PK_AdditionalCheckRequests", x => x.Id); }); migrationBuilder.CreateTable( name: "Document", columns: table => new { Id = table.Column(type: "RAW(16)", nullable: false), FileName = table.Column(type: "NVARCHAR2(255)", maxLength: 255, nullable: false), FileSize = table.Column(type: "NUMBER(10)", nullable: false), FileType = table.Column(type: "NVARCHAR2(128)", maxLength: 128, nullable: false), Detail = table.Column(type: "NCLOB", nullable: false), ObjectRefId = table.Column(type: "RAW(16)", nullable: false), CreatedDate = table.Column(type: "TIMESTAMP(7)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_Document", x => x.Id); }); migrationBuilder.CreateTable( name: "DutyTimes", 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 ที่แก้ไขข้อมูลล่าสุด"), Description = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "คำอธิบาย"), StartTimeMorning = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เวลาเข้างานช่วงเช้า"), EndTimeMorning = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เวลาออกงานช่วงเช้า"), StartTimeAfternoon = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เวลาเข้างานช่วงบ่าย"), EndTimeAfternoon = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เวลาออกงานช่วงบ่าย"), IsDefault = table.Column(type: "NUMBER(1)", nullable: false, comment: "สถานะว่ารอบใดเป็นค่า Default ของข้าราชการ (สำหรับทุกคนที่ยังไม่ได้ทำการเลือกรอบ)"), IsActive = table.Column(type: "NUMBER(1)", nullable: false, comment: "สถานะการเปิดใช้งาน (เปิด/ปิด)") }, constraints: table => { table.PrimaryKey("PK_DutyTimes", x => x.Id); }); migrationBuilder.CreateTable( name: "LeaveTypes", 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: "ชื่อประเภทการลา"), Code = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รหัสประเภทการลา"), Limit = table.Column(type: "NUMBER(10)", nullable: false, comment: "จำนวนวันลาสูงสุดประจำปี") }, constraints: table => { table.PrimaryKey("PK_LeaveTypes", x => x.Id); }); migrationBuilder.CreateTable( name: "ProcessUserTimeStamps", 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 ที่แก้ไขข้อมูลล่าสุด"), KeycloakUserId = table.Column(type: "RAW(16)", nullable: false, comment: "รหัส User ของ Keycloak"), CheckIn = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "วัน เวลา เข้างาน"), CheckOut = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วัน เวลา ออกงาน"), IsProcess = table.Column(type: "NUMBER(1)", nullable: false, comment: "นำไปประมวลผลแล้วหรือยัง"), CheckInLat = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดละติจูด Check-In"), CheckInLon = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดลองจิจูด Check-In"), CheckInPOI = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In"), IsLocationCheckIn = table.Column(type: "NUMBER(1)", nullable: false, comment: "true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In"), CheckInLocationName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In"), CheckInImageUrl = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รูปถ่ายสถานที่ Check-In"), CheckInRemark = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In"), CheckInStatus = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะ Check-In"), CheckOutLat = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดละติจูด Check-Out"), CheckOutLon = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดลองจิจูด Check-Out"), CheckOutPOI = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out"), IsLocationCheckOut = table.Column(type: "NUMBER(1)", nullable: false, comment: "true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out"), CheckOutLocationName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out"), CheckOutImageUrl = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รูปถ่ายสถานที่ Check-Out"), CheckOutRemark = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out"), CheckOutStatus = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะ Check-Out"), EditStatus = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะการของลงเวลาพิเศษ"), EditReason = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เหตุผลการอนุมัติ/ไม่อนุมัติขอลงเวลาพิเศษ") }, constraints: table => { table.PrimaryKey("PK_ProcessUserTimeStamps", x => x.Id); }); migrationBuilder.CreateTable( name: "UserCalendars", 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 ที่แก้ไขข้อมูลล่าสุด"), ProfileId = table.Column(type: "RAW(16)", nullable: false, comment: "รหัส Profile ในระบบทะเบียนประวัติ"), Calendar = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ปฏิทินการทำงานของ ขรก ปกติ หรือ 6 วันต่อสัปดาห์") }, constraints: table => { table.PrimaryKey("PK_UserCalendars", x => x.Id); }); migrationBuilder.CreateTable( name: "UserTimeStamps", 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 ที่แก้ไขข้อมูลล่าสุด"), KeycloakUserId = table.Column(type: "RAW(16)", nullable: false, comment: "รหัส User ของ Keycloak"), CheckIn = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "วัน เวลา เข้างาน"), CheckOut = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วัน เวลา ออกงาน"), IsProcess = table.Column(type: "NUMBER(1)", nullable: false, comment: "นำไปประมวลผลแล้วหรือยัง"), CheckInLat = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดละติจูด Check-In"), CheckInLon = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดลองจิจูด Check-In"), CheckInPOI = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-In"), IsLocationCheckIn = table.Column(type: "NUMBER(1)", nullable: false, comment: "true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-In"), CheckInLocationName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-In"), CheckInImageUrl = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รูปถ่ายสถานที่ Check-In"), CheckInRemark = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-In"), CheckOutLat = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดละติจูด Check-Out"), CheckOutLon = table.Column(type: "BINARY_DOUBLE", nullable: false, comment: "พิกัดลองจิจูด Check-Out"), CheckOutPOI = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "ชื่อสถานที่ ได้มาจากระบบ ArcGis ของกองสารสนเทศภูมิศาสตร์ Check-Out"), IsLocationCheckOut = table.Column(type: "NUMBER(1)", nullable: false, comment: "true คือ ณ สถานที่ตั้ง, false คือ นอกสถานที่ตั้ง Check-Out"), CheckOutLocationName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "กรณีเลือกนอกสถานที่ตั้ง ต้องระบุข้อมูลชื่อสถานะที่ Check-Out"), CheckOutImageUrl = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รูปถ่ายสถานที่ Check-Out"), CheckOutRemark = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ข้อความหมายเหตุที่ต้องการระบุเพิ่ม(มีเผื่อไว้อาจไม่ได้ใช้) Check-Out") }, constraints: table => { table.PrimaryKey("PK_UserTimeStamps", x => x.Id); }); migrationBuilder.CreateTable( name: "UserDutyTimes", 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 ที่แก้ไขข้อมูลล่าสุด"), ProfileId = table.Column(type: "RAW(16)", nullable: false, comment: "รหัส Profile ในระบบทะเบียนประวัติ"), DutyTimeId = table.Column(type: "RAW(16)", nullable: false, comment: "รหัสรอบการลงเวลา"), EffectiveDate = table.Column(type: "TIMESTAMP(7)", nullable: true, comment: "วันที่มีผล"), IsProcess = table.Column(type: "NUMBER(1)", nullable: false, comment: "ทำการประมวลผลแล้วหรือยัง"), Remark = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "หมายเหตุ") }, constraints: table => { table.PrimaryKey("PK_UserDutyTimes", x => x.Id); table.ForeignKey( name: "FK_UserDutyTimes_DutyTimes_DutyTimeId", column: x => x.DutyTimeId, principalTable: "DutyTimes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "LeaveRequests", 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 ที่แก้ไขข้อมูลล่าสุด"), TypeId = table.Column(type: "RAW(16)", nullable: false), LeaveStartDate = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "วัน เดือน ปีเริ่มต้นลา"), LeaveEndDate = table.Column(type: "TIMESTAMP(7)", nullable: false, comment: "วัน เดือน ปีสิ้นสุดลา"), LeaveWrote = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "เขียนที่"), LeaveAddress = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานที่ติดต่อขณะลา"), LeaveNumber = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "หมายเลขที่ติดต่อขณะลา"), LeaveDetail = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "รายละเอียดการลา"), LeaveDraftDocumentId = table.Column(type: "RAW(16)", nullable: true), LeaveSalaryText = table.Column(type: "NVARCHAR2(2000)", nullable: false), WifeDayName = table.Column(type: "NVARCHAR2(2000)", nullable: false), WifeDayDateBorn = table.Column(type: "NVARCHAR2(2000)", nullable: false), RestDayOldTotal = table.Column(type: "BINARY_DOUBLE", nullable: false), RestDayCurrentTotal = table.Column(type: "BINARY_DOUBLE", nullable: false), OrdainDayStatus = table.Column(type: "NUMBER(1)", nullable: false), OrdainDayLocationName = table.Column(type: "NVARCHAR2(2000)", nullable: false), OrdainDayLocationAddress = table.Column(type: "NVARCHAR2(2000)", nullable: false), OrdainDayLocationNumber = table.Column(type: "NVARCHAR2(2000)", nullable: false), OrdainDayOrdination = table.Column(type: "TIMESTAMP(7)", nullable: false), OrdainDayBuddhistLentName = table.Column(type: "NVARCHAR2(2000)", nullable: false), OrdainDayBuddhistLentAddress = table.Column(type: "NVARCHAR2(2000)", nullable: false), HajjDayStatus = table.Column(type: "NUMBER(1)", nullable: false), AbsentDaySummon = table.Column(type: "NVARCHAR2(2000)", nullable: false), AbsentDayLocation = table.Column(type: "NVARCHAR2(2000)", nullable: false), AbsentDayRegistorDate = table.Column(type: "TIMESTAMP(7)", nullable: false), AbsentDayGetIn = table.Column(type: "NVARCHAR2(2000)", nullable: false), AbsentDayAt = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDaySubject = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDayDegreeLevel = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDayUniversityName = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDayTrainingSubject = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDayTrainingName = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDayCountry = table.Column(type: "NVARCHAR2(2000)", nullable: false), StudyDayScholarship = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayName = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayPosition = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayLevel = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayLevelCountry = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayCountryHistory = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayTotalHistory = table.Column(type: "NVARCHAR2(2000)", nullable: false), CoupleDayStartDateHistory = table.Column(type: "TIMESTAMP(7)", nullable: false), CoupleDayEndDateHistory = table.Column(type: "TIMESTAMP(7)", nullable: false), CoupleDaySumTotalHistory = table.Column(type: "NVARCHAR2(2000)", nullable: false), LeaveStatus = table.Column(type: "NVARCHAR2(2000)", nullable: false, comment: "สถานะของคำร้อง"), LeaveComment = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ความเห็นของผู้บังคับบัญชา"), LeaveDirectorComment = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ความเห็นของผู้อำนวยการสำนัก"), LeaveTotal = table.Column(type: "BINARY_DOUBLE", nullable: false), LeaveLast = table.Column(type: "TIMESTAMP(7)", nullable: true), KeycloakUserId = table.Column(type: "RAW(16)", nullable: false), LeaveBirthDate = table.Column(type: "TIMESTAMP(7)", nullable: true), LeaveGovernmentDate = table.Column(type: "TIMESTAMP(7)", nullable: true), LeaveSalary = table.Column(type: "NUMBER(10)", nullable: true), LeaveCancelStatus = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สถานะของคำขอยกเลิก"), LeaveCancelComment = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เหตุผลในการขอยกเลิก"), LeaveCancelDocumentId = table.Column(type: "RAW(16)", nullable: true), ApproveStep = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "step การอนุมัติ st1 = จทน.อนุมัตื,st2 = ผู้บังคับบัญชา อนุมัติ "), CancelLeaveWrote = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เขียนที่ (ขอยกเลิก)"), LeaveRange = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ช่วงของการลา เช่น ลาทั้งวัน ครึ่งวันเช้า ครึ่งวันบ่าย"), Dear = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "เรียนใคร"), LeaveTypeCode = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "code ของประเภทการลา"), PositionName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ตำแหน่งผู้ยื่นขอ"), PositionLevelName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "ระดับผู้ยื่นขอ"), OrganizationName = table.Column(type: "NVARCHAR2(2000)", nullable: true, comment: "สังกัดผู้ยื่นขอ") }, constraints: table => { table.PrimaryKey("PK_LeaveRequests", x => x.Id); table.ForeignKey( name: "FK_LeaveRequests_Document_LeaveCancelDocumentId", column: x => x.LeaveCancelDocumentId, principalTable: "Document", principalColumn: "Id"); table.ForeignKey( name: "FK_LeaveRequests_Document_LeaveDraftDocumentId", column: x => x.LeaveDraftDocumentId, principalTable: "Document", principalColumn: "Id"); table.ForeignKey( name: "FK_LeaveRequests_LeaveTypes_TypeId", column: x => x.TypeId, principalTable: "LeaveTypes", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateTable( name: "LeaveDocuments", 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), LeaveRequestId = table.Column(type: "RAW(16)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_LeaveDocuments", x => x.Id); table.ForeignKey( name: "FK_LeaveDocuments_Document_DocumentId", column: x => x.DocumentId, principalTable: "Document", principalColumn: "Id", onDelete: ReferentialAction.Cascade); table.ForeignKey( name: "FK_LeaveDocuments_LeaveRequests_LeaveRequestId", column: x => x.LeaveRequestId, principalTable: "LeaveRequests", principalColumn: "Id", onDelete: ReferentialAction.Cascade); }); migrationBuilder.CreateIndex( name: "IX_LeaveDocuments_DocumentId", table: "LeaveDocuments", column: "DocumentId"); migrationBuilder.CreateIndex( name: "IX_LeaveDocuments_LeaveRequestId", table: "LeaveDocuments", column: "LeaveRequestId"); migrationBuilder.CreateIndex( name: "IX_LeaveRequests_LeaveCancelDocumentId", table: "LeaveRequests", column: "LeaveCancelDocumentId"); migrationBuilder.CreateIndex( name: "IX_LeaveRequests_LeaveDraftDocumentId", table: "LeaveRequests", column: "LeaveDraftDocumentId"); migrationBuilder.CreateIndex( name: "IX_LeaveRequests_TypeId", table: "LeaveRequests", column: "TypeId"); migrationBuilder.CreateIndex( name: "IX_UserDutyTimes_DutyTimeId", table: "UserDutyTimes", column: "DutyTimeId"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "AdditionalCheckRequests"); migrationBuilder.DropTable( name: "LeaveDocuments"); migrationBuilder.DropTable( name: "ProcessUserTimeStamps"); migrationBuilder.DropTable( name: "UserCalendars"); migrationBuilder.DropTable( name: "UserDutyTimes"); migrationBuilder.DropTable( name: "UserTimeStamps"); migrationBuilder.DropTable( name: "LeaveRequests"); migrationBuilder.DropTable( name: "DutyTimes"); migrationBuilder.DropTable( name: "Document"); migrationBuilder.DropTable( name: "LeaveTypes"); } } }