From 29ed88b5a7348014876d227e2c9446cc38ebaf95 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 18 Mar 2025 18:31:05 +0700 Subject: [PATCH] update default "PENDING" --- src/entities/SalaryProfile.ts | 6 ++--- src/entities/SalaryProfileEmployee.ts | 4 ++-- ...date_profileSalary_and_profileSalaryEmp.ts | 22 +++++++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 src/migration/1742297168141-update_profileSalary_and_profileSalaryEmp.ts diff --git a/src/entities/SalaryProfile.ts b/src/entities/SalaryProfile.ts index f15b297..54100dd 100644 --- a/src/entities/SalaryProfile.ts +++ b/src/entities/SalaryProfile.ts @@ -168,21 +168,21 @@ export class SalaryProfile extends EntityBase { @Column({ comment: "สถานะออกคำสั่ง33", length: 20, - default: null, + default: "PENDING", }) status33: string; @Column({ comment: "สถานะออกคำสั่ง34", length: 20, - default: null, + default: "PENDING", }) status34: string; @Column({ comment: "สถานะออกคำสั่ง35", length: 20, - default: null, + default: "PENDING", }) status35: string; diff --git a/src/entities/SalaryProfileEmployee.ts b/src/entities/SalaryProfileEmployee.ts index 2e355c5..1645792 100644 --- a/src/entities/SalaryProfileEmployee.ts +++ b/src/entities/SalaryProfileEmployee.ts @@ -220,14 +220,14 @@ export class SalaryProfileEmployee extends EntityBase { @Column({ comment: "สถานะออกคำสั่ง36", length: 20, - default: null, + default: "PENDING", }) status36: string; @Column({ comment: "สถานะออกคำสั่ง37", length: 20, - default: null, + default: "PENDING", }) status37: string; diff --git a/src/migration/1742297168141-update_profileSalary_and_profileSalaryEmp.ts b/src/migration/1742297168141-update_profileSalary_and_profileSalaryEmp.ts new file mode 100644 index 0000000..b9e1969 --- /dev/null +++ b/src/migration/1742297168141-update_profileSalary_and_profileSalaryEmp.ts @@ -0,0 +1,22 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateProfileSalaryAndProfileSalaryEmp1742297168141 implements MigrationInterface { + name = 'UpdateProfileSalaryAndProfileSalaryEmp1742297168141' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`status36\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง36' DEFAULT 'PENDING'`); + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` ADD \`status37\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง37' DEFAULT 'PENDING'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`status33\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง33' DEFAULT 'PENDING'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`status34\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง34' DEFAULT 'PENDING'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` ADD \`status35\` varchar(20) NOT NULL COMMENT 'สถานะออกคำสั่ง35' DEFAULT 'PENDING'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`status35\``); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`status34\``); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` DROP COLUMN \`status33\``); + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`status37\``); + await queryRunner.query(`ALTER TABLE \`salaryProfileEmployee\` DROP COLUMN \`status36\``); + } + +}