234 lines
13 KiB
C#
234 lines
13 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace BMA.EHR.Infrastructure.Migrations.DisciplineDb
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class createtableDisciplineDirector : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "RespondentType",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)",
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Appellant",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "ผู้ร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ComplaintFrom",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "รับเรื่องร้องเรียนจาก ระบุว่ารับเรื่องมาจากใคร/หน่วยงานไหน (สตง., ปปช., ปปท., จดหมาย, อีเมล, โทรศัพท์, บอกกล่าว)")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "ConsideredAgency",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "หน่วยงานที่พิจารณา จะเปลี่ยนไปตามผู้ถูกร้องดูรายละเอียดด้านล่าง")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "DateConsideration",
|
|
table: "DisciplineComplaints",
|
|
type: "datetime(6)",
|
|
nullable: true,
|
|
comment: "วันที่กำหนดพิจารณา");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "DateNotification",
|
|
table: "DisciplineComplaints",
|
|
type: "datetime(6)",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
comment: "วันแจ้งเตือนล่วงหน้า");
|
|
|
|
migrationBuilder.AddColumn<DateTime>(
|
|
name: "DateReceived",
|
|
table: "DisciplineComplaints",
|
|
type: "datetime(6)",
|
|
nullable: false,
|
|
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified),
|
|
comment: "วันที่รับเรื่อง เป็นวันที่ถือเป็นจุดเริ่มต้นของวินัยนั้น ๆ");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Description",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "รายละเอียดของเรื่องร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "LevelConsideration",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "ระดับการพิจารณา 'ยังไม่ระบุ' (NORMAL คือ ปกติ, URGENT คือ ด่วน, VERY_URGENT คือ ด่วนมาก)")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "OffenseDetails",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "ลักษณะความผิดครั้งแรกจะเป็น 'ยังไม่ระบุ' (NOT_SPECIFIED คือ ยังไม่ระบุ, NOT_DEADLY คือ ไม่ร้ายแรง, DEADLY คือ ร้ายแรง)")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Status",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "สถานะเรื่องร้องเรียน มีดังนี้ ใหม่ (NEW), ยุติเรื่อง (STOP), มีมูลส่งไปสืบสวนแล้ว (SEND_INVESTIGATE)")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "Title",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
comment: "เรื่องที่ร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineComplaint_Channels",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Name = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อประเภทการร้องเรียน")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineComplaint_Channels", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "DisciplineDirectors",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
|
|
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
|
|
CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
|
|
LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
FirstName = table.Column<string>(type: "longtext", nullable: false, comment: "ชื่อ")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
LastName = table.Column<string>(type: "longtext", nullable: false, comment: "นามสกุล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Position = table.Column<string>(type: "longtext", nullable: false, comment: "ตำแหน่ง")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Email = table.Column<string>(type: "longtext", nullable: false, comment: "อีเมล")
|
|
.Annotation("MySql:CharSet", "utf8mb4"),
|
|
Phone = table.Column<string>(type: "longtext", nullable: false, comment: "เบอร์โทรศัพท์")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_DisciplineDirectors", x => x.Id);
|
|
})
|
|
.Annotation("MySql:CharSet", "utf8mb4");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineComplaint_Channels");
|
|
|
|
migrationBuilder.DropTable(
|
|
name: "DisciplineDirectors");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Appellant",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ComplaintFrom",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "ConsideredAgency",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DateConsideration",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DateNotification",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "DateReceived",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Description",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "LevelConsideration",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "OffenseDetails",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Status",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "Title",
|
|
table: "DisciplineComplaints");
|
|
|
|
migrationBuilder.AlterColumn<string>(
|
|
name: "RespondentType",
|
|
table: "DisciplineComplaints",
|
|
type: "longtext",
|
|
nullable: false,
|
|
oldClrType: typeof(string),
|
|
oldType: "longtext",
|
|
oldComment: "ผู้ถูกร้องเรียน (PERSON คือ บุคคล, ORGANIZATION คือ หน่วยงาน, BANGKOK คือ กรุงเทพมหานคร)")
|
|
.Annotation("MySql:CharSet", "utf8mb4")
|
|
.OldAnnotation("MySql:CharSet", "utf8mb4");
|
|
}
|
|
}
|
|
}
|