updata_table_profile_add_salary

This commit is contained in:
kittapath 2024-11-05 09:26:15 +07:00
parent 48ce332d19
commit d6f5b87eee
2 changed files with 49 additions and 1 deletions

View file

@ -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[];

View file

@ -0,0 +1,24 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdataTableProfileAddSalary1730773461743 implements MigrationInterface {
name = 'UpdataTableProfileAddSalary1730773461743'
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
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\``);
}
}