From 02e824f8c4e4ab27c80f6fa73d78490d411c1b44 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 27 Feb 2024 10:30:28 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9F=E0=B8=B4=E0=B8=A715%=20=E0=B8=97=E0=B8=A8=E0=B8=99?= =?UTF-8?q?=E0=B8=B4=E0=B8=A2=E0=B8=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/SalaryOrg.ts | 11 +++++++++-- ...update_table_salaryPeriod_add_fifteenPoint.ts | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 src/migration/1709004502447-update_table_salaryPeriod_add_fifteenPoint.ts diff --git a/src/entities/SalaryOrg.ts b/src/entities/SalaryOrg.ts index 93f1533..c114a62 100644 --- a/src/entities/SalaryOrg.ts +++ b/src/entities/SalaryOrg.ts @@ -1,4 +1,4 @@ -import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany } from "typeorm"; +import { Entity, Column, ManyToOne, JoinColumn, OneToOne, OneToMany, Double } from "typeorm"; import { EntityBase } from "./base/Base"; import { SalaryPeriod } from "./SalaryPeriod"; import { SalaryProfile } from "./SalaryProfile"; @@ -28,10 +28,17 @@ export class SalaryOrg extends EntityBase { total: number; @Column({ - comment: "15%ของจำนวนคน", + comment: "15%ของจำนวนคน(จำนวนเต็ม)", }) fifteenPercent: number; + @Column({ + comment: "15%ของจำนวนคน(จุดทศนิยม)", + type: "double", + default: 0, + }) + fifteenPoint: Double; + @Column({ comment: "กลุ่ม GROUP1->กลุ่ม1 GROUP2->กลุ่ม2", length: 10, diff --git a/src/migration/1709004502447-update_table_salaryPeriod_add_fifteenPoint.ts b/src/migration/1709004502447-update_table_salaryPeriod_add_fifteenPoint.ts new file mode 100644 index 0000000..bd300ef --- /dev/null +++ b/src/migration/1709004502447-update_table_salaryPeriod_add_fifteenPoint.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableSalaryPeriodAddFifteenPoint1709004502447 implements MigrationInterface { + name = 'UpdateTableSalaryPeriodAddFifteenPoint1709004502447' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryOrg\` ADD \`fifteenPoint\` double NOT NULL COMMENT '15%ของจำนวนคน(จุดทศนิยม)' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`salaryOrg\` CHANGE \`fifteenPercent\` \`fifteenPercent\` int NOT NULL COMMENT '15%ของจำนวนคน(จำนวนเต็ม)'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryOrg\` CHANGE \`fifteenPercent\` \`fifteenPercent\` int NOT NULL COMMENT '15%ของจำนวนคน'`); + await queryRunner.query(`ALTER TABLE \`salaryOrg\` DROP COLUMN \`fifteenPoint\``); + } + +}