diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 235fc81c..c971be08 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -8,6 +8,14 @@ import { ProfileDisciplineEmployee } from "./ProfileDisciplineEmployee"; @Entity("profileEmployee") export class ProfileEmployee extends EntityBase { + @Column({ + nullable: true, + comment: "ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)", + length: 40, + default: null, + }) + employeeClass: string; + @Column({ nullable: true, comment: "ยศ", diff --git a/src/migration/1715571667160-update_table_profileemployee_add_employeeClass.ts b/src/migration/1715571667160-update_table_profileemployee_add_employeeClass.ts new file mode 100644 index 00000000..e3cc6323 --- /dev/null +++ b/src/migration/1715571667160-update_table_profileemployee_add_employeeClass.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileemployeeAddEmployeeClass1715571667160 implements MigrationInterface { + name = 'UpdateTableProfileemployeeAddEmployeeClass1715571667160' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`employeeClass\` varchar(40) NULL COMMENT 'ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`employeeClass\` varchar(40) NULL COMMENT 'ประเภทลูกจ้าง (perm->ลูกจ้างประจำ temp->ลูกจ้างชั่วคราว)'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`employeeClass\``); + await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`employeeClass\``); + } + +}