diff --git a/src/entities/SalaryProfile.ts b/src/entities/SalaryProfile.ts index cb40717..fcd764e 100644 --- a/src/entities/SalaryProfile.ts +++ b/src/entities/SalaryProfile.ts @@ -51,7 +51,9 @@ export class SalaryProfile extends EntityBase { posMasterNoPrefix: string; @Column({ + nullable: true, comment: "เลขที่ตำแหน่ง เป็นตัวเลข", + default: null, }) posMasterNo: number; @@ -80,53 +82,67 @@ export class SalaryProfile extends EntityBase { position: string; @Column({ + nullable: true, comment: "ประเภทตำแหน่ง", length: 100, + default: null, }) posType: string; @Column({ + nullable: true, comment: "ระดับตำแหน่ง", length: 100, + default: null, }) posLevel: string; @Column({ + nullable: true, comment: "ตำแหน่งทางการบริหาร", length: 255, + default: null, }) posExecutive: string; @Column({ + nullable: true, comment: "เงินเดือนฐาน", + default: null, }) amount: number; @Column({ + nullable: true, comment: "เงินพิเศษ", + default: null, }) amountSpecial: number; @Column({ + nullable: true, comment: "จำนวนเงินที่ใช้เลื่อน", + default: null, }) amountUse: number; @Column({ + nullable: true, comment: "เงินเดือนหลังเลื่อน", + default: null, }) positionSalaryAmount: number; @Column({ - nullable: true, comment: "ประเภทการเลื่อน(ขั้น) PENDING->รายชื่อคนครอง NONE->ไม่ได้เลื่อน HAFT->ครึ่งขั้น FULL->1ขั้น FULLHAFT->1.5ขั้น", length: 20, - default: null, + default: "PENDING", }) type: string; @Column({ + nullable: true, comment: "", length: 40, }) @@ -141,6 +157,7 @@ export class SalaryProfile extends EntityBase { root: string; @Column({ + nullable: true, comment: "", length: 40, }) @@ -155,6 +172,7 @@ export class SalaryProfile extends EntityBase { child1: string; @Column({ + nullable: true, comment: "", length: 40, }) @@ -169,6 +187,7 @@ export class SalaryProfile extends EntityBase { child2: string; @Column({ + nullable: true, comment: "", length: 40, }) @@ -183,6 +202,7 @@ export class SalaryProfile extends EntityBase { child3: string; @Column({ + nullable: true, comment: "", length: 40, }) diff --git a/src/migration/1709006642536-update_table_salaryPeriod_add_fifteenPoint1.ts b/src/migration/1709006642536-update_table_salaryPeriod_add_fifteenPoint1.ts new file mode 100644 index 0000000..5501103 --- /dev/null +++ b/src/migration/1709006642536-update_table_salaryPeriod_add_fifteenPoint1.ts @@ -0,0 +1,40 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableSalaryPeriodAddFifteenPoint11709006642536 implements MigrationInterface { + name = 'UpdateTableSalaryPeriodAddFifteenPoint11709006642536' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posMasterNo\` \`posMasterNo\` int NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posType\` \`posType\` varchar(100) NULL COMMENT 'ประเภทตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posLevel\` \`posLevel\` varchar(100) NULL COMMENT 'ระดับตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posExecutive\` \`posExecutive\` varchar(255) NULL COMMENT 'ตำแหน่งทางการบริหาร'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amount\` \`amount\` int NULL COMMENT 'เงินเดือนฐาน'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountSpecial\` \`amountSpecial\` int NULL COMMENT 'เงินพิเศษ'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountUse\` \`amountUse\` int NULL COMMENT 'จำนวนเงินที่ใช้เลื่อน'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`positionSalaryAmount\` \`positionSalaryAmount\` int NULL COMMENT 'เงินเดือนหลังเลื่อน'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`type\` \`type\` varchar(20) NOT NULL COMMENT 'ประเภทการเลื่อน(ขั้น) PENDING->รายชื่อคนครอง NONE->ไม่ได้เลื่อน HAFT->ครึ่งขั้น FULL->1ขั้น FULLHAFT->1.5ขั้น' DEFAULT 'PENDING'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`rootId\` \`rootId\` varchar(40) NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child1Id\` \`child1Id\` varchar(40) NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child2Id\` \`child2Id\` varchar(40) NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child3Id\` \`child3Id\` varchar(40) NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child4Id\` \`child4Id\` varchar(40) NULL`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child4Id\` \`child4Id\` varchar(40) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child3Id\` \`child3Id\` varchar(40) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child2Id\` \`child2Id\` varchar(40) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`child1Id\` \`child1Id\` varchar(40) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`rootId\` \`rootId\` varchar(40) NOT NULL`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`type\` \`type\` varchar(20) NULL COMMENT 'ประเภทการเลื่อน(ขั้น) PENDING->รายชื่อคนครอง NONE->ไม่ได้เลื่อน HAFT->ครึ่งขั้น FULL->1ขั้น FULLHAFT->1.5ขั้น'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`positionSalaryAmount\` \`positionSalaryAmount\` int NOT NULL COMMENT 'เงินเดือนหลังเลื่อน'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountUse\` \`amountUse\` int NOT NULL COMMENT 'จำนวนเงินที่ใช้เลื่อน'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amountSpecial\` \`amountSpecial\` int NOT NULL COMMENT 'เงินพิเศษ'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`amount\` \`amount\` int NOT NULL COMMENT 'เงินเดือนฐาน'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posExecutive\` \`posExecutive\` varchar(255) NOT NULL COMMENT 'ตำแหน่งทางการบริหาร'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posLevel\` \`posLevel\` varchar(100) NOT NULL COMMENT 'ระดับตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posType\` \`posType\` varchar(100) NOT NULL COMMENT 'ประเภทตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`salaryProfile\` CHANGE \`posMasterNo\` \`posMasterNo\` int NOT NULL COMMENT 'เลขที่ตำแหน่ง เป็นตัวเลข'`); + } + +}