diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index bfca8489..27bf80bc 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -159,6 +159,13 @@ export class Profile extends EntityBase { }) isLeave: boolean; + @Column({ + nullable: true, + comment: "เหตุผลเกษียณ", + default: null, + }) + leaveReason: string; + @Column({ nullable: true, type: "datetime", diff --git a/src/migration/1716649829280-update_table_profile_add_leaveReason.ts b/src/migration/1716649829280-update_table_profile_add_leaveReason.ts new file mode 100644 index 00000000..db8fd2da --- /dev/null +++ b/src/migration/1716649829280-update_table_profile_add_leaveReason.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileAddLeaveReason1716649829280 implements MigrationInterface { + name = 'UpdateTableProfileAddLeaveReason1716649829280' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`leaveReason\` varchar(255) NULL COMMENT 'เหตุผลเกษียณ'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`leaveReason\` varchar(255) NULL COMMENT 'เหตุผลเกษียณ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`leaveReason\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`leaveReason\``); + } + +}