Merge branch 'develop' into adiDev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 58s
All checks were successful
Build & Deploy on Dev / build (push) Successful in 58s
This commit is contained in:
commit
2de708ae37
3 changed files with 35 additions and 0 deletions
|
|
@ -188,6 +188,12 @@ export class Profile extends EntityBase {
|
||||||
})
|
})
|
||||||
keycloak: string;
|
keycloak: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "สถานะการถูกลบผู้ใช้งานใน keycloak",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
isDelete: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "ทดลองปฏิบัติหน้าที่",
|
comment: "ทดลองปฏิบัติหน้าที่",
|
||||||
default: false,
|
default: false,
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,12 @@ export class ProfileEmployee extends EntityBase {
|
||||||
})
|
})
|
||||||
keycloak: string;
|
keycloak: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
comment: "สถานะการถูกลบผู้ใช้งานใน keycloak",
|
||||||
|
default: false,
|
||||||
|
})
|
||||||
|
isDelete: boolean;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "ทดลองปฏิบัติหน้าที่",
|
comment: "ทดลองปฏิบัติหน้าที่",
|
||||||
default: false,
|
default: false,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class UpdateProfileAndProfileemployeeAddFieldIsdelete1775112029663 implements MigrationInterface {
|
||||||
|
name = 'UpdateProfileAndProfileemployeeAddFieldIsdelete1775112029663'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
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<void> {
|
||||||
|
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\``);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue