diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index 72a1d505..fe2f55d6 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -188,12 +188,6 @@ export class Profile extends EntityBase { }) keycloak: string; - @Column({ - comment: "สถานะการถูกลบผู้ใช้งานใน keycloak", - default: false, - }) - isDelete: boolean; - @Column({ comment: "ทดลองปฏิบัติหน้าที่", default: false, diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index 11c2159b..2c3f06e4 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -204,12 +204,6 @@ export class ProfileEmployee extends EntityBase { }) keycloak: string; - @Column({ - comment: "สถานะการถูกลบผู้ใช้งานใน keycloak", - default: false, - }) - isDelete: boolean; - @Column({ comment: "ทดลองปฏิบัติหน้าที่", default: false, diff --git a/src/migration/1775112029663-update_profile_and_profileemployee_add_field_isdelete.ts b/src/migration/1775112029663-update_profile_and_profileemployee_add_field_isdelete.ts deleted file mode 100644 index 706f3d59..00000000 --- a/src/migration/1775112029663-update_profile_and_profileemployee_add_field_isdelete.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { MigrationInterface, QueryRunner } from "typeorm"; - -export class UpdateProfileAndProfileemployeeAddFieldIsdelete1775112029663 implements MigrationInterface { - name = 'UpdateProfileAndProfileemployeeAddFieldIsdelete1775112029663' - - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`isDelete\` tinyint NOT NULL COMMENT 'สถานะการถูกลบผู้ใช้งานใน keycloak' DEFAULT 0`); - await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`isDelete\` tinyint NOT NULL COMMENT 'สถานะการถูกลบผู้ใช้งานใน keycloak' DEFAULT 0`); - await queryRunner.query(`ALTER TABLE \`profile\` ADD \`isDelete\` tinyint NOT NULL COMMENT 'สถานะการถูกลบผู้ใช้งานใน keycloak' DEFAULT 0`); - await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`isDelete\` tinyint NOT NULL COMMENT 'สถานะการถูกลบผู้ใช้งานใน keycloak' DEFAULT 0`); - - // Update ข้อมูลเดิม: ถ้า keycloak null → isDelete = true (1), ถ้ามีค่า → isDelete = false (0) - await queryRunner.query(`UPDATE \`profileEmployee\` SET \`isDelete\` = CASE WHEN \`keycloak\` IS NULL THEN 1 ELSE 0 END`); - await queryRunner.query(`UPDATE \`profile\` SET \`isDelete\` = CASE WHEN \`keycloak\` IS NULL THEN 1 ELSE 0 END`); - } - - public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`isDelete\``); - await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`isDelete\``); - await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`isDelete\``); - await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`isDelete\``); - } -}