From 52fca7813c66c3f23b853a15dea489dc3471a506 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 27 Aug 2025 15:19:32 +0700 Subject: [PATCH] migrate (create table registry and registryEmployee) --- src/entities/Registry.ts | 417 ++++++++++++++++++ src/entities/RegistryEmployee.ts | 375 ++++++++++++++++ .../1756282384029-create_table_registry_.ts | 16 + 3 files changed, 808 insertions(+) create mode 100644 src/entities/Registry.ts create mode 100644 src/entities/RegistryEmployee.ts create mode 100644 src/migration/1756282384029-create_table_registry_.ts diff --git a/src/entities/Registry.ts b/src/entities/Registry.ts new file mode 100644 index 00000000..6bd03545 --- /dev/null +++ b/src/entities/Registry.ts @@ -0,0 +1,417 @@ +import { + Entity, + Column +} from "typeorm"; +import { EntityBase } from "./base/Base"; + +@Entity("registry") +export class Registry extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง profile", + default: null, + }) + profileId: string; + + @Column({ + nullable: true, + comment: "เลขประจำตัวประชาชน", + default: null, + length: 13, + }) + citizenId: string; + + @Column({ + nullable: true, + length: 20, + comment: "คำนำหน้าชื่อ เช่น นาย นาง นางสาว", + default: null, + }) + prefix: string; + + @Column({ + nullable: true, + comment: "ชื่อ", + length: 255, + default: null, + }) + firstName: string; + + @Column({ + nullable: true, + comment: "นามสกุล", + length: 255, + default: null, + }) + lastName: string; + + @Column({ + comment: "ทดลองปฏิบัติหน้าที่", + default: false, + }) + isProbation: boolean; + + @Column({ + comment: "พ้นราชการ", + default: false, + }) + isLeave: boolean; + + @Column({ + comment: "เกษียณ", + default: false, + }) + isRetirement: boolean; + + @Column({ + nullable: true, + length: 255, + comment: "ประเภทพ้นคำสั่งพ้นจากราชการ", + default: null, + }) + leaveType: string; + + @Column({ + nullable: true, + comment: "เลขที่ตำแหน่ง เป็นตัวเลข", + default: null, + }) + posMasterNo: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgRoot", + default: null, + }) + orgRootId?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild1", + default: null, + }) + orgChild1Id?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild2", + default: null, + }) + orgChild2Id?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild3", + default: null, + }) + orgChild3Id?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild4", + default: null, + }) + orgChild4Id?: string; + + @Column({ + nullable: true, + comment: "ชื่อหน่วยงาน", + length: 255, + default: null, + }) + orgRootName: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child1", + length: 255, + default: null, + }) + orgChild1Name: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child2", + length: 255, + default: null, + }) + orgChild2Name: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child3", + length: 255, + default: null, + }) + orgChild3Name: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child4", + length: 255, + default: null, + }) + orgChild4Name: string; + + @Column({ + nullable: true, + length: 255, + comment: "สังกัด", + default: null, + }) + org: string; + + @Column({ + nullable: true, + length: 255, + comment: "เลขที่ตำแหน่ง", + default: null, + }) + searchShortName: string; + + @Column({ + nullable: true, + comment: "ชื่อตำแหน่งทางการบริหาร", + length: 255, + default: null, + }) + posExecutiveName: string; + + @Column({ + nullable: true, + comment: "ชื่อตำแหน่งในสายงาน", + length: 255, + default: null, + }) + position: string; + + @Column({ + nullable: true, + length: 255, + comment: "ประเภทตำแหน่ง", + default: null, + }) + posTypeName: string; + + @Column({ + nullable: true, + length: 255, + comment: "ระดับตำแหน่ง", + default: null, + }) + posLevelName: string; + + @Column({ + nullable: true, + comment: "เพศ", + length: 40, + default: null, + }) + gender: string; + + @Column({ + nullable: true, + comment: "ความสัมพันธ์", + length: 40, + default: null, + }) + relationship: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่บรรจุ", + default: null, + }) + dateAppoint: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันครบเกษียณอายุ", + default: null, + }) + dateRetire: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่เกษียณอายุราชการตามกฏหมาย", + default: null, + }) + dateRetireLaw: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันเกิด", + default: null, + }) + birthdate: Date; + + @Column({ + nullable: true, + comment: "วุฒิการศึกษา", + length: 255, + default: null, + }) + degrees: string; + + @Column({ + nullable: true, + comment: "อายุ", + default: null, + }) + age: number; + + @Column({ + nullable: true, + comment: "จำนวนปีระยะเวลาดำรงตำแหน่งในสายงาน", + default: null, + }) + Years: number; + + @Column({ + nullable: true, + comment: "จำนวนเดือนระยะเวลาดำรงตำแหน่งในสายงาน", + default: null, + }) + Months: number; + + @Column({ + nullable: true, + comment: "จำนวนวันระยะเวลาดำรงตำแหน่งในสายงาน", + default: null, + }) + Days: number; + + @Column({ + nullable: true, + comment: "จำนวนปีระยะเวลาดำรงตำแหน่งตามระดับ", + default: null, + }) + levelYears: number; + + @Column({ + nullable: true, + comment: "จำนวนเดือนระยะเวลาดำรงตำแหน่งตามระดับ", + default: null, + }) + levelMonths: number; + + @Column({ + nullable: true, + comment: "จำนวนวันระยะเวลาดำรงตำแหน่งตามระดับ", + default: null, + }) + levelDays: number; + + @Column({ + nullable: true, + comment: "จำนวนปีระยะเวลาดำรงตำแหน่งทางการบริหาร", + default: null, + }) + posExecutiveYears: number; + + @Column({ + nullable: true, + comment: "จำนวนเดือนระยะเวลาดำรงตำแหน่งทางการบริหาร", + default: null, + }) + posExecutiveMonths: number; + + @Column({ + nullable: true, + comment: "จำนวนวันระยะเวลาดำรงตำแหน่งทางการบริหาร", + default: null, + }) + posExecutiveDays: number; + + @Column({ + nullable: true, + comment: "ด้าน/สาขา", + length: 255, + default: null, + }) + positionArea: string; + + @Column({ + type: "text", + nullable: true, + comment: "วุฒิการศึกษา", + default: null, + }) + Educations: string; + + @Column({ + nullable: true, + comment: "ระดับศึกษา", + length: 255, + default: null, + }) + educationLevels: string; + + @Column({ + nullable: true, + comment: "สาขาวิชา/ทาง", + length: 255, + default: null, + }) + fields: string; +} + +export class RegistryCreateDto { + profileId: string; + citizenId?: string | null; + prefix?: string | null; + firstName?: string | null; + lastName?: string | null; + isProbation?: boolean | null; + isLeave?: boolean | null; + isRetirement?: boolean | null; + leaveType?: string | null; + posMasterNo?: string | null; + orgRootId?: string | null; + orgChild1Id?: string | null; + orgChild2Id?: string | null; + orgChild3Id?: string | null; + orgChild4Id?: string | null; + orgRootName?: string | null; + orgChild1Name?: string | null; + orgChild2Name?: string | null; + orgChild3Name?: string | null; + orgChild4Name?: string | null; + org?: string | null; + searchShortName?: string | null; + posExecutiveName?: string | null; + position?: string | null; + posTypeName?: string | null; + posLevelName?: string | null; + gender?: string | null; + relationship?: string | null; + dateAppoint?: Date | null; + dateRetire?: Date | null; + dateRetireLaw?: Date | null; + birthdate?: Date | null; + degrees?: string | null; + age?: number | null; + Years?: number | null; + Months?: number | null; + Days?: number | null; + levelYears?: number | null; + levelMonths?: number | null; + levelDays?: number | null; + posExecutiveYears?: number | null; + posExecutiveMonths?: number | null; + posExecutiveDays?: number | null; + positionArea?: string | null; + Educations?: string | null; + educationLevels?: string | null; + fields?: string | null; +} \ No newline at end of file diff --git a/src/entities/RegistryEmployee.ts b/src/entities/RegistryEmployee.ts new file mode 100644 index 00000000..d84acfde --- /dev/null +++ b/src/entities/RegistryEmployee.ts @@ -0,0 +1,375 @@ +import { + Entity, + Column +} from "typeorm"; +import { EntityBase } from "./base/Base"; + +@Entity("registryEmployee") +export class RegistryEmployee extends EntityBase { + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง profileEmployee", + default: null, + }) + profileEmployeeId: string; + + @Column({ + nullable: true, + comment: "เลขประจำตัวประชาชน", + default: null, + length: 13, + }) + citizenId: string; + + @Column({ + nullable: true, + length: 20, + comment: "คำนำหน้าชื่อ เช่น นาย นาง นางสาว", + default: null, + }) + prefix: string; + + @Column({ + nullable: true, + comment: "ชื่อ", + length: 255, + default: null, + }) + firstName: string; + + @Column({ + nullable: true, + comment: "นามสกุล", + length: 255, + default: null, + }) + lastName: string; + + @Column({ + comment: "ทดลองปฏิบัติหน้าที่", + default: false, + }) + isProbation: boolean; + + @Column({ + comment: "พ้นราชการ", + default: false, + }) + isLeave: boolean; + + @Column({ + comment: "เกษียณ", + default: false, + }) + isRetirement: boolean; + + @Column({ + nullable: true, + length: 255, + comment: "ประเภทพ้นคำสั่งพ้นจากราชการ", + default: null, + }) + leaveType: string; + + @Column({ + nullable: true, + comment: "เลขที่ตำแหน่ง เป็นตัวเลข", + default: null, + }) + posMasterNo: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgRoot", + default: null, + }) + orgRootId?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild1", + default: null, + }) + orgChild1Id?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild2", + default: null, + }) + orgChild2Id?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild3", + default: null, + }) + orgChild3Id?: string; + + @Column({ + nullable: true, + length: 40, + comment: "คีย์นอก(FK)ของตาราง orgChild4", + default: null, + }) + orgChild4Id?: string; + + @Column({ + nullable: true, + comment: "ชื่อหน่วยงาน", + length: 255, + default: null, + }) + orgRootName: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child1", + length: 255, + default: null, + }) + orgChild1Name: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child2", + length: 255, + default: null, + }) + orgChild2Name: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child3", + length: 255, + default: null, + }) + orgChild3Name: string; + + @Column({ + nullable: true, + comment: "ชื่อส่วนราชการ Child4", + length: 255, + default: null, + }) + orgChild4Name: string; + + @Column({ + nullable: true, + length: 255, + comment: "สังกัด", + default: null, + }) + org: string; + + @Column({ + nullable: true, + length: 255, + comment: "เลขที่ตำแหน่ง", + default: null, + }) + searchShortName: string; + + @Column({ + nullable: true, + comment: "ชื่อตำแหน่งในสายงาน", + length: 255, + default: null, + }) + position: string; + + @Column({ + nullable: true, + length: 255, + comment: "ประเภทตำแหน่ง", + default: null, + }) + posTypeName: string; + + @Column({ + nullable: true, + length: 255, + comment: "ระดับตำแหน่ง", + default: null, + }) + posLevelName: string; + + @Column({ + nullable: true, + comment: "เพศ", + length: 40, + default: null, + }) + gender: string; + + @Column({ + nullable: true, + comment: "ความสัมพันธ์", + length: 40, + default: null, + }) + relationship: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่บรรจุ", + default: null, + }) + dateAppoint: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันครบเกษียณอายุ", + default: null, + }) + dateRetire: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่เกษียณอายุราชการตามกฏหมาย", + default: null, + }) + dateRetireLaw: Date; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันเกิด", + default: null, + }) + birthdate: Date; + + @Column({ + nullable: true, + comment: "วุฒิการศึกษา", + length: 255, + default: null, + }) + degrees: string; + + @Column({ + nullable: true, + comment: "อายุ", + default: null, + }) + age: number; + + @Column({ + nullable: true, + comment: "จำนวนปีระยะเวลาดำรงตำแหน่งในสายงาน", + default: null, + }) + Years: number; + + @Column({ + nullable: true, + comment: "จำนวนเดือนระยะเวลาดำรงตำแหน่งในสายงาน", + default: null, + }) + Months: number; + + @Column({ + nullable: true, + comment: "จำนวนวันระยะเวลาดำรงตำแหน่งในสายงาน", + default: null, + }) + Days: number; + + @Column({ + nullable: true, + comment: "จำนวนปีระยะเวลาดำรงตำแหน่งตามระดับ", + default: null, + }) + levelYears: number; + + @Column({ + nullable: true, + comment: "จำนวนเดือนระยะเวลาดำรงตำแหน่งตามระดับ", + default: null, + }) + levelMonths: number; + + @Column({ + nullable: true, + comment: "จำนวนวันระยะเวลาดำรงตำแหน่งตามระดับ", + default: null, + }) + levelDays: number; + + @Column({ + type: "text", + nullable: true, + comment: "วุฒิการศึกษา", + default: null, + }) + Educations: string; + + @Column({ + nullable: true, + comment: "ระดับศึกษา", + length: 255, + default: null, + }) + educationLevels: string; + + @Column({ + nullable: true, + comment: "สาขาวิชา/ทาง", + length: 255, + default: null, + }) + fields: string; +} + +export class RegistryEmployeeCreateDto { + profileEmployeeId: string; + citizenId?: string | null; + prefix?: string | null; + firstName?: string | null; + lastName?: string | null; + isProbation?: boolean | null; + isLeave?: boolean | null; + isRetirement?: boolean | null; + leaveType?: string | null; + posMasterNo?: string | null; + // orgRootId?: string | null; + orgChild1Id?: string | null; + orgChild2Id?: string | null; + orgChild3Id?: string | null; + orgChild4Id?: string | null; + orgRootName?: string | null; + orgChild1Name?: string | null; + orgChild2Name?: string | null; + orgChild3Name?: string | null; + orgChild4Name?: string | null; + org?: string | null; + searchShortName?: string | null; + position?: string | null; + posTypeName?: string | null; + posLevelName?: string | null; + gender?: string | null; + relationship?: string | null; + dateAppoint?: Date | null; + dateRetire?: Date | null; + dateRetireLaw?: Date | null; + birthdate?: Date | null; + degrees?: string | null; + age?: number | null; + Years?: number | null; + Months?: number | null; + Days?: number | null; + levelYears?: number | null; + levelMonths?: number | null; + levelDays?: number | null; + Educations?: string | null; + educationLevels?: string | null; + fields?: string | null; +} \ No newline at end of file diff --git a/src/migration/1756282384029-create_table_registry_.ts b/src/migration/1756282384029-create_table_registry_.ts new file mode 100644 index 00000000..fe3b8d02 --- /dev/null +++ b/src/migration/1756282384029-create_table_registry_.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class CreateTableRegistry_1756282384029 implements MigrationInterface { + name = 'CreateTableRegistry_1756282384029' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`CREATE TABLE \`registryEmployee\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'System Administrator', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'System Administrator', \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profileEmployee', \`citizenId\` varchar(13) NULL COMMENT 'เลขประจำตัวประชาชน', \`prefix\` varchar(20) NULL COMMENT 'คำนำหน้าชื่อ เช่น นาย นาง นางสาว', \`firstName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'นามสกุล', \`isProbation\` tinyint NOT NULL COMMENT 'ทดลองปฏิบัติหน้าที่' DEFAULT 0, \`isLeave\` tinyint NOT NULL COMMENT 'พ้นราชการ' DEFAULT 0, \`isRetirement\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT 0, \`leaveType\` varchar(255) NULL COMMENT 'ประเภทพ้นคำสั่งพ้นจากราชการ', \`posMasterNo\` varchar(255) NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข', \`orgRootId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot', \`orgChild1Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1', \`orgChild2Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild2', \`orgChild3Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild3', \`orgChild4Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild4', \`orgRootName\` varchar(255) NULL COMMENT 'ชื่อหน่วยงาน', \`orgChild1Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child1', \`orgChild2Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child2', \`orgChild3Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child3', \`orgChild4Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child4', \`org\` varchar(255) NULL COMMENT 'สังกัด', \`searchShortName\` varchar(255) NULL COMMENT 'เลขที่ตำแหน่ง', \`position\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน', \`posTypeName\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง', \`posLevelName\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง', \`gender\` varchar(40) NULL COMMENT 'เพศ', \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์', \`dateAppoint\` datetime NULL COMMENT 'วันที่บรรจุ', \`dateRetire\` datetime NULL COMMENT 'วันครบเกษียณอายุ', \`dateRetireLaw\` datetime NULL COMMENT 'วันที่เกษียณอายุราชการตามกฏหมาย', \`birthdate\` datetime NULL COMMENT 'วันเกิด', \`degrees\` varchar(255) NULL COMMENT 'วุฒิการศึกษา', \`age\` int NULL COMMENT 'อายุ', \`Years\` int NULL COMMENT 'จำนวนปีระยะเวลาดำรงตำแหน่งในสายงาน', \`Months\` int NULL COMMENT 'จำนวนเดือนระยะเวลาดำรงตำแหน่งในสายงาน', \`Days\` int NULL COMMENT 'จำนวนวันระยะเวลาดำรงตำแหน่งในสายงาน', \`levelYears\` int NULL COMMENT 'จำนวนปีระยะเวลาดำรงตำแหน่งตามระดับ', \`levelMonths\` int NULL COMMENT 'จำนวนเดือนระยะเวลาดำรงตำแหน่งตามระดับ', \`levelDays\` int NULL COMMENT 'จำนวนวันระยะเวลาดำรงตำแหน่งตามระดับ', \`Educations\` text NULL COMMENT 'วุฒิการศึกษา', \`educationLevels\` varchar(255) NULL COMMENT 'ระดับศึกษา', \`fields\` varchar(255) NULL COMMENT 'สาขาวิชา/ทาง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); + await queryRunner.query(`CREATE TABLE \`registry\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'System Administrator', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'System Administrator', \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', \`citizenId\` varchar(13) NULL COMMENT 'เลขประจำตัวประชาชน', \`prefix\` varchar(20) NULL COMMENT 'คำนำหน้าชื่อ เช่น นาย นาง นางสาว', \`firstName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'นามสกุล', \`isProbation\` tinyint NOT NULL COMMENT 'ทดลองปฏิบัติหน้าที่' DEFAULT 0, \`isLeave\` tinyint NOT NULL COMMENT 'พ้นราชการ' DEFAULT 0, \`isRetirement\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT 0, \`leaveType\` varchar(255) NULL COMMENT 'ประเภทพ้นคำสั่งพ้นจากราชการ', \`posMasterNo\` varchar(255) NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข', \`orgRootId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgRoot', \`orgChild1Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild1', \`orgChild2Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild2', \`orgChild3Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild3', \`orgChild4Id\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง orgChild4', \`orgRootName\` varchar(255) NULL COMMENT 'ชื่อหน่วยงาน', \`orgChild1Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child1', \`orgChild2Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child2', \`orgChild3Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child3', \`orgChild4Name\` varchar(255) NULL COMMENT 'ชื่อส่วนราชการ Child4', \`org\` varchar(255) NULL COMMENT 'สังกัด', \`searchShortName\` varchar(255) NULL COMMENT 'เลขที่ตำแหน่ง', \`posExecutiveName\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งทางการบริหาร', \`position\` varchar(255) NULL COMMENT 'ชื่อตำแหน่งในสายงาน', \`posTypeName\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง', \`posLevelName\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง', \`gender\` varchar(40) NULL COMMENT 'เพศ', \`relationship\` varchar(40) NULL COMMENT 'ความสัมพันธ์', \`dateAppoint\` datetime NULL COMMENT 'วันที่บรรจุ', \`dateRetire\` datetime NULL COMMENT 'วันครบเกษียณอายุ', \`dateRetireLaw\` datetime NULL COMMENT 'วันที่เกษียณอายุราชการตามกฏหมาย', \`birthdate\` datetime NULL COMMENT 'วันเกิด', \`degrees\` varchar(255) NULL COMMENT 'วุฒิการศึกษา', \`age\` int NULL COMMENT 'อายุ', \`Years\` int NULL COMMENT 'จำนวนปีระยะเวลาดำรงตำแหน่งในสายงาน', \`Months\` int NULL COMMENT 'จำนวนเดือนระยะเวลาดำรงตำแหน่งในสายงาน', \`Days\` int NULL COMMENT 'จำนวนวันระยะเวลาดำรงตำแหน่งในสายงาน', \`levelYears\` int NULL COMMENT 'จำนวนปีระยะเวลาดำรงตำแหน่งตามระดับ', \`levelMonths\` int NULL COMMENT 'จำนวนเดือนระยะเวลาดำรงตำแหน่งตามระดับ', \`levelDays\` int NULL COMMENT 'จำนวนวันระยะเวลาดำรงตำแหน่งตามระดับ', \`posExecutiveYears\` int NULL COMMENT 'จำนวนปีระยะเวลาดำรงตำแหน่งทางการบริหาร', \`posExecutiveMonths\` int NULL COMMENT 'จำนวนเดือนระยะเวลาดำรงตำแหน่งทางการบริหาร', \`posExecutiveDays\` int NULL COMMENT 'จำนวนวันระยะเวลาดำรงตำแหน่งทางการบริหาร', \`positionArea\` varchar(255) NULL COMMENT 'ด้าน/สาขา', \`Educations\` text NULL COMMENT 'วุฒิการศึกษา', \`educationLevels\` varchar(255) NULL COMMENT 'ระดับศึกษา', \`fields\` varchar(255) NULL COMMENT 'สาขาวิชา/ทาง', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`DROP TABLE \`registry\``); + await queryRunner.query(`DROP TABLE \`registryEmployee\``); + } + +}