From d6f5b87eeeb912ba6a9f782af28942c886a34bac Mon Sep 17 00:00:00 2001 From: kittapath Date: Tue, 5 Nov 2024 09:26:15 +0700 Subject: [PATCH] updata_table_profile_add_salary --- src/entities/Profile.ts | 26 ++++++++++++++++++- ...3461743-updata_table_profile_add_salary.ts | 24 +++++++++++++++++ 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 src/migration/1730773461743-updata_table_profile_add_salary.ts diff --git a/src/entities/Profile.ts b/src/entities/Profile.ts index dedb7834..ff23fe98 100644 --- a/src/entities/Profile.ts +++ b/src/entities/Profile.ts @@ -1,4 +1,4 @@ -import { Entity, Column, OneToMany, JoinColumn, ManyToOne } from "typeorm"; +import { Entity, Column, OneToMany, JoinColumn, ManyToOne, Double } from "typeorm"; import { EntityBase } from "./base/Base"; import { PosMaster } from "./PosMaster"; import { PosLevel } from "./PosLevel"; @@ -307,6 +307,30 @@ export class Profile extends EntityBase { }) bloodGroup: string; + @Column({ + comment: "เงินเดือนฐาน", + default: 0, + nullable: true, + type: "double", + }) + amount: Double; + + @Column({ + comment: "เงินประจำตำแหน่ง", + default: 0, + nullable: true, + type: "double", + }) + positionSalaryAmount: Double; + + @Column({ + comment: "เงินค่าตอบแทนรายเดือน", + default: 0, + nullable: true, + type: "double", + }) + mouthSalaryAmount: Double; + @OneToMany(() => PosMaster, (posMaster) => posMaster.current_holder) current_holders: PosMaster[]; diff --git a/src/migration/1730773461743-updata_table_profile_add_salary.ts b/src/migration/1730773461743-updata_table_profile_add_salary.ts new file mode 100644 index 00000000..d5e0e05d --- /dev/null +++ b/src/migration/1730773461743-updata_table_profile_add_salary.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdataTableProfileAddSalary1730773461743 implements MigrationInterface { + name = 'UpdataTableProfileAddSalary1730773461743' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profile\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`amount\` double NULL COMMENT 'เงินเดือนฐาน' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`positionSalaryAmount\` double NULL COMMENT 'เงินประจำตำแหน่ง' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profileHistory\` ADD \`mouthSalaryAmount\` double NULL COMMENT 'เงินค่าตอบแทนรายเดือน' DEFAULT '0'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`mouthSalaryAmount\``); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`positionSalaryAmount\``); + await queryRunner.query(`ALTER TABLE \`profileHistory\` DROP COLUMN \`amount\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`mouthSalaryAmount\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`positionSalaryAmount\``); + await queryRunner.query(`ALTER TABLE \`profile\` DROP COLUMN \`amount\``); + } + +}