migrate + fix issue #993
This commit is contained in:
parent
7a0ab2271d
commit
4011abe5ea
5 changed files with 142 additions and 43 deletions
20
src/migration/1738139755428-update_table_profileEmp.ts
Normal file
20
src/migration/1738139755428-update_table_profileEmp.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
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\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue