hrms-api-org/src/migration/1738139755428-update_table_profileEmp.ts
2025-01-29 15:41:14 +07:00

20 lines
1.5 KiB
TypeScript

import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableProfileEmp1738139755428 implements MigrationInterface {
name = 'UpdateTableProfileEmp1738139755428'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`isRetirement\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`isRetirement\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'พ้นราชการ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'พ้นราชการ' DEFAULT 0`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` CHANGE \`isLeave\` \`isLeave\` tinyint NOT NULL COMMENT 'เกษียณ' DEFAULT '0'`);
await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`isRetirement\``);
await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`isRetirement\``);
}
}