From 94771726aaefc2e054857f4c710ed720ed714d36 Mon Sep 17 00:00:00 2001 From: Bright Date: Mon, 27 Jan 2025 11:14:38 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9F=E0=B8=B4=E0=B8=A5=E0=B8=94=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/Profile.ts | 40 +++++++++++++++++ src/entities/ProfileEmployee.ts | 40 +++++++++++++++++ ...780-update_table_profile_and_profileEmp.ts | 44 +++++++++++++++++++ 3 files changed, 124 insertions(+) create mode 100644 src/migration/1737951091780-update_table_profile_and_profileEmp.ts diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index 39d17905..f36160c9 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -365,6 +365,46 @@ export class Profile extends EntityBase { }) mouthSalaryAmount: Double; + @Column({ + nullable: true, + length: 40, + comment: "ไอดีคำสั่งพ้นจากราชการ", + default: null, + }) + leaveCommandId: string; + + @Column({ + nullable: true, + length: 255, + comment: "เลขที่คำสั่งพ้นจากราชการ", + default: null, + }) + leaveCommandNo: string; + + @Column({ + nullable: true, + comment: "หมายเหตุแนวตั้งคำสั่งพ้นจากราชการ", + type: "text", + default: null, + }) + leaveRemark: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ลงนามคำสั่งพ้นจากราชการ", + default: null, + }) + leaveDate: Date | null; + + @Column({ + nullable: true, + type: "text", + comment: "ประเภทพ้นคำสั่งพ้นจากราชการ", + default: null, + }) + leaveType: string; + @OneToMany(() => PosMaster, (posMaster) => posMaster.current_holder) current_holders: PosMaster[]; diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 16841f8f..50d7eeb3 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -616,6 +616,46 @@ export class ProfileEmployee extends EntityBase { }) mouthSalaryAmount: Double; + @Column({ + nullable: true, + length: 40, + comment: "ไอดีคำสั่งพ้นจากราชการ", + default: null, + }) + leaveCommandId: string; + + @Column({ + nullable: true, + length: 255, + comment: "เลขที่คำสั่งพ้นจากราชการ", + default: null, + }) + leaveCommandNo: string; + + @Column({ + nullable: true, + comment: "หมายเหตุแนวตั้งคำสั่งพ้นจากราชการ", + type: "text", + default: null, + }) + leaveRemark: string; + + @Column({ + nullable: true, + type: "datetime", + comment: "วันที่ลงนามคำสั่งพ้นจากราชการ", + default: null, + }) + leaveDate: Date | null; + + @Column({ + nullable: true, + type: "text", + comment: "ประเภทพ้นคำสั่งพ้นจากราชการ", + default: null, + }) + leaveType: string; + @OneToMany(() => ProfileEmployeeInformationHistory, (v) => v.profileEmployeeInformation) information_histories: ProfileEmployeeInformationHistory[]; diff --git a/src/migration/1737951091780-update_table_profile_and_profileEmp.ts b/src/migration/1737951091780-update_table_profile_and_profileEmp.ts new file mode 100644 index 00000000..3206a0fb --- /dev/null +++ b/src/migration/1737951091780-update_table_profile_and_profileEmp.ts @@ -0,0 +1,44 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileAndProfileEmp1737951091780 implements MigrationInterface { + name = 'UpdateTableProfileAndProfileEmp1737951091780' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`leaveType\` text NULL COMMENT 'ประเภทพ้นคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`leaveCommandId\` varchar(40) NULL COMMENT 'ไอดีคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`leaveCommandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`leaveRemark\` text NULL COMMENT 'หมายเหตุแนวตั้งคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`leaveDate\` datetime NULL COMMENT 'วันที่ลงนามคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`leaveType\` text NULL COMMENT 'ประเภทพ้นคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`leaveCommandId\` varchar(40) NULL COMMENT 'ไอดีคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`leaveCommandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`leaveRemark\` text NULL COMMENT 'หมายเหตุแนวตั้งคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`leaveDate\` datetime NULL COMMENT 'วันที่ลงนามคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`leaveType\` text NULL COMMENT 'ประเภทพ้นคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`leaveCommandId\` varchar(40) NULL COMMENT 'ไอดีคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`leaveCommandNo\` varchar(255) NULL COMMENT 'เลขที่คำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`leaveRemark\` text NULL COMMENT 'หมายเหตุแนวตั้งคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`leaveDate\` datetime NULL COMMENT 'วันที่ลงนามคำสั่งพ้นจากราชการ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`leaveType\` text NULL COMMENT 'ประเภทพ้นคำสั่งพ้นจากราชการ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`leaveType\``); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`leaveDate\``); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`leaveRemark\``); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`leaveCommandNo\``); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`leaveCommandId\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`leaveType\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`leaveDate\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`leaveRemark\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`leaveCommandNo\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`leaveCommandId\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`leaveType\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`leaveDate\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`leaveRemark\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`leaveCommandNo\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`leaveCommandId\``); + await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`leaveType\``); + } + +}