diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index f36160c9..41f9375f 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -189,11 +189,17 @@ export class Profile extends EntityBase { isProbation: boolean; @Column({ - comment: "เกษียณ", + comment: "พ้นราชการ", default: false, }) isLeave: boolean; + @Column({ + comment: "เกษียณ", + default: false, + }) + isRetirement: boolean; + @Column({ comment: "สถานะการใช้งาน", default: true, diff --git a/src/migration/1738037460278-UpdateprofileaddisRetirement.ts b/src/migration/1738037460278-UpdateprofileaddisRetirement.ts new file mode 100644 index 00000000..a7b95961 --- /dev/null +++ b/src/migration/1738037460278-UpdateprofileaddisRetirement.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateprofileaddisRetirement1738037460278 implements MigrationInterface { + name = 'UpdateprofileaddisRetirement1738037460278' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`isRetirement\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`isRetirement\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`profile\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'พ้นราชการ' DEFAULT 0`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'พ้นราชการ' DEFAULT 0`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHistory\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profile\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`isRetirement\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`isRetirement\``); + } + +}