From f03ccb78ac6b5707264ac804e25f7ad603197cda Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 12 Feb 2026 12:10:14 +0700 Subject: [PATCH] Migrate move isDeleted in profileSalary --- src/entities/ProfileSalary.ts | 7 ------- src/entities/ProfileSalaryBackup.ts | 7 ------- src/entities/ProfileSalaryHistory.ts | 7 ------- ...ields_isDeleted_in_tables_profileSalary.ts | 19 +++++++++++++++++++ 4 files changed, 19 insertions(+), 21 deletions(-) create mode 100644 src/migration/1770872734016-move_fields_isDeleted_in_tables_profileSalary.ts diff --git a/src/entities/ProfileSalary.ts b/src/entities/ProfileSalary.ts index 1ab7acab..ddbe184b 100644 --- a/src/entities/ProfileSalary.ts +++ b/src/entities/ProfileSalary.ts @@ -287,13 +287,6 @@ export class ProfileSalary extends EntityBase { }) positionArea: string; - @Column({ - nullable: false, - comment: "สถานะลบข้อมูล", - default: false, - }) - isDeleted: boolean; - @ManyToOne(() => Command, (command) => command.profileSalarys) @JoinColumn({ name: "commandId" }) command: Command; diff --git a/src/entities/ProfileSalaryBackup.ts b/src/entities/ProfileSalaryBackup.ts index 1274e319..29cdd325 100644 --- a/src/entities/ProfileSalaryBackup.ts +++ b/src/entities/ProfileSalaryBackup.ts @@ -292,11 +292,4 @@ export class ProfileSalaryBackup extends EntityBase { }) positionArea: string; - @Column({ - nullable: false, - comment: "สถานะลบข้อมูล", - default: false, - }) - isDeleted: boolean; - } \ No newline at end of file diff --git a/src/entities/ProfileSalaryHistory.ts b/src/entities/ProfileSalaryHistory.ts index b5482c29..ea6af033 100644 --- a/src/entities/ProfileSalaryHistory.ts +++ b/src/entities/ProfileSalaryHistory.ts @@ -228,13 +228,6 @@ export class ProfileSalaryHistory extends EntityBase { }) posNumCodeSitAbb: string; - @Column({ - nullable: false, - comment: "สถานะลบข้อมูล", - default: false, - }) - isDeleted: boolean; - @ManyToOne(() => Command, (command) => command.profileSalaryHistorys) @JoinColumn({ name: "commandId" }) command: Command; diff --git a/src/migration/1770872734016-move_fields_isDeleted_in_tables_profileSalary.ts b/src/migration/1770872734016-move_fields_isDeleted_in_tables_profileSalary.ts new file mode 100644 index 00000000..31d4a79c --- /dev/null +++ b/src/migration/1770872734016-move_fields_isDeleted_in_tables_profileSalary.ts @@ -0,0 +1,19 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class MoveFieldsIsDeletedInTablesProfileSalary1770872734016 implements MigrationInterface { + name = 'MoveFieldsIsDeletedInTablesProfileSalary1770872734016' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`isDeleted\``); + await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP COLUMN \`isDeleted\``); + await queryRunner.query(`ALTER TABLE \`profileSalaryBackup\` DROP COLUMN \`isDeleted\``); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryBackup\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT '0'`); + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`isDeleted\` tinyint NOT NULL COMMENT 'สถานะลบข้อมูล' DEFAULT '0'`); + + } + +}