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