From d29a4a4747a190a4d085446cd9eec4d5da235678 Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 10 Dec 2024 09:49:41 +0700 Subject: [PATCH] migration profileSalaryHistory --- src/entities/ProfileSalaryHistory.ts | 10 ++++++++++ .../1733798795372-update_table_add_field.ts | 14 ++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/migration/1733798795372-update_table_add_field.ts diff --git a/src/entities/ProfileSalaryHistory.ts b/src/entities/ProfileSalaryHistory.ts index f8f9193d..f419c222 100644 --- a/src/entities/ProfileSalaryHistory.ts +++ b/src/entities/ProfileSalaryHistory.ts @@ -83,6 +83,14 @@ export class ProfileSalaryHistory extends EntityBase { }) amount: Double; + @Column({ + comment: "เงินพิเศษ", + default: 0, + nullable: true, + type: "double", + }) + amountSpecial: Double; + @Column({ comment: "เงินประจำตำแหน่ง", default: 0, @@ -149,6 +157,7 @@ export class CreateProfileSalaryHistory { profileId: string; date?: Date | null; amount?: Double | null; + amountSpecial?: Double | null; positionSalaryAmount?: Double | null; mouthSalaryAmount?: Double | null; posNo: string | null; @@ -165,6 +174,7 @@ export class CreateProfileSalaryHistory { export class UpdateProfileSalaryHistory { date?: Date | null; amount?: Double | null; + amountSpecial?: Double | null; positionSalaryAmount?: Double | null; mouthSalaryAmount?: Double | null; posNo?: string | null; diff --git a/src/migration/1733798795372-update_table_add_field.ts b/src/migration/1733798795372-update_table_add_field.ts new file mode 100644 index 00000000..596c200c --- /dev/null +++ b/src/migration/1733798795372-update_table_add_field.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableAddField1733798795372 implements MigrationInterface { + name = 'UpdateTableAddField1733798795372' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`amountSpecial\` double NULL COMMENT 'เงินพิเศษ' DEFAULT '0'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`amountSpecial\``); + } + +}