From 7c77745d46a705bdc858e05d5672a782867bd69b Mon Sep 17 00:00:00 2001 From: harid Date: Tue, 16 Jun 2026 09:53:23 +0700 Subject: [PATCH 1/2] migrate add field all tables #252 --- src/controllers/OrgChild1Controller.ts | 8 +++ src/controllers/OrgChild2Controller.ts | 8 +++ src/controllers/OrgChild3Controller.ts | 8 +++ src/controllers/OrgChild4Controller.ts | 8 +++ src/controllers/OrgRootController.ts | 8 +++ src/entities/OrgChild1.ts | 56 +++++++++++++++++++ src/entities/OrgChild2.ts | 56 +++++++++++++++++++ src/entities/OrgChild3.ts | 56 +++++++++++++++++++ src/entities/OrgChild4.ts | 56 +++++++++++++++++++ src/entities/OrgRoot.ts | 56 +++++++++++++++++++ ...597453-update_add_field_code_all_tables.ts | 51 +++++++++++++++++ 11 files changed, 371 insertions(+) create mode 100644 src/migration/1781577597453-update_add_field_code_all_tables.ts diff --git a/src/controllers/OrgChild1Controller.ts b/src/controllers/OrgChild1Controller.ts index d59ce669..6817d6fd 100644 --- a/src/controllers/OrgChild1Controller.ts +++ b/src/controllers/OrgChild1Controller.ts @@ -74,7 +74,11 @@ export class OrgChild1Controller { DIVISION_CODE: orgChild1.DIVISION_CODE, SECTION_CODE: orgChild1.SECTION_CODE, JOB_CODE: orgChild1.JOB_CODE, + ROOT_CODE: orgChild1.ROOT_CODE, CHILD1_CODE: orgChild1.CHILD1_CODE, + CHILD2_CODE: orgChild1.CHILD2_CODE, + CHILD3_CODE: orgChild1.CHILD3_CODE, + CHILD4_CODE: orgChild1.CHILD4_CODE, orgCode: orgChild1.orgRoot.orgRootCode + orgChild1.orgChild1Code, }; return new HttpSuccess(getOrgChild1); @@ -347,7 +351,11 @@ export class OrgChild1Controller { DIVISION_CODE: requestBody.DIVISION_CODE != null ? requestBody.DIVISION_CODE : _null, SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null, JOB_CODE: requestBody.JOB_CODE != null ? requestBody.JOB_CODE : _null, + ROOT_CODE: requestBody.ROOT_CODE != null ? requestBody.ROOT_CODE : _null, CHILD1_CODE: requestBody.CHILD1_CODE != null ? requestBody.CHILD1_CODE : _null, + CHILD2_CODE: requestBody.CHILD2_CODE != null ? requestBody.CHILD2_CODE : _null, + CHILD3_CODE: requestBody.CHILD3_CODE != null ? requestBody.CHILD3_CODE : _null, + CHILD4_CODE: requestBody.CHILD4_CODE != null ? requestBody.CHILD4_CODE : _null, isOfficer: requestBody.isOfficer, isInformation: requestBody.isInformation, orgChild1PhoneEx: requestBody.orgChild1PhoneEx, diff --git a/src/controllers/OrgChild2Controller.ts b/src/controllers/OrgChild2Controller.ts index 1cc4186d..650cc96e 100644 --- a/src/controllers/OrgChild2Controller.ts +++ b/src/controllers/OrgChild2Controller.ts @@ -85,7 +85,11 @@ export class OrgChild2Controller extends Controller { DIVISION_CODE: orgChild2.DIVISION_CODE, SECTION_CODE: orgChild2.SECTION_CODE, JOB_CODE: orgChild2.JOB_CODE, + ROOT_CODE: orgChild2.ROOT_CODE, + CHILD1_CODE: orgChild2.CHILD1_CODE, CHILD2_CODE: orgChild2.CHILD2_CODE, + CHILD3_CODE: orgChild2.CHILD3_CODE, + CHILD4_CODE: orgChild2.CHILD4_CODE, orgCode: orgChild2.orgRoot.orgRootCode + orgChild2.orgChild2Code, }; return new HttpSuccess(getOrgChild2); @@ -253,7 +257,11 @@ export class OrgChild2Controller extends Controller { DIVISION_CODE: requestBody.DIVISION_CODE != null ? requestBody.DIVISION_CODE : _null, SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null, JOB_CODE: requestBody.JOB_CODE != null ? requestBody.JOB_CODE : _null, + ROOT_CODE: requestBody.ROOT_CODE != null ? requestBody.ROOT_CODE : _null, + CHILD1_CODE: requestBody.CHILD1_CODE != null ? requestBody.CHILD1_CODE : _null, CHILD2_CODE: requestBody.CHILD2_CODE != null ? requestBody.CHILD2_CODE : _null, + CHILD3_CODE: requestBody.CHILD3_CODE != null ? requestBody.CHILD3_CODE : _null, + CHILD4_CODE: requestBody.CHILD4_CODE != null ? requestBody.CHILD4_CODE : _null, orgChild2PhoneEx: requestBody.orgChild2PhoneEx, orgChild2PhoneIn: requestBody.orgChild2PhoneIn, orgChild2Fax: requestBody.orgChild2Fax, diff --git a/src/controllers/OrgChild3Controller.ts b/src/controllers/OrgChild3Controller.ts index a3861d55..d8cc5939 100644 --- a/src/controllers/OrgChild3Controller.ts +++ b/src/controllers/OrgChild3Controller.ts @@ -69,7 +69,11 @@ export class OrgChild3Controller { DIVISION_CODE: orgChild3.DIVISION_CODE, SECTION_CODE: orgChild3.SECTION_CODE, JOB_CODE: orgChild3.JOB_CODE, + ROOT_CODE: orgChild3.ROOT_CODE, + CHILD1_CODE: orgChild3.CHILD1_CODE, + CHILD2_CODE: orgChild3.CHILD2_CODE, CHILD3_CODE: orgChild3.CHILD3_CODE, + CHILD4_CODE: orgChild3.CHILD4_CODE, orgCode: orgChild3.orgRoot.orgRootCode + orgChild3.orgChild3Code, }; return new HttpSuccess(getOrgChild3); @@ -208,7 +212,11 @@ export class OrgChild3Controller { DIVISION_CODE: requestBody.DIVISION_CODE != null ? requestBody.DIVISION_CODE : _null, SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null, JOB_CODE: requestBody.JOB_CODE != null ? requestBody.JOB_CODE : _null, + ROOT_CODE: requestBody.ROOT_CODE != null ? requestBody.ROOT_CODE : _null, + CHILD1_CODE: requestBody.CHILD1_CODE != null ? requestBody.CHILD1_CODE : _null, + CHILD2_CODE: requestBody.CHILD2_CODE != null ? requestBody.CHILD2_CODE : _null, CHILD3_CODE: requestBody.CHILD3_CODE != null ? requestBody.CHILD3_CODE : _null, + CHILD4_CODE: requestBody.CHILD4_CODE != null ? requestBody.CHILD4_CODE : _null, orgChild3PhoneEx: requestBody.orgChild3PhoneEx, orgChild3PhoneIn: requestBody.orgChild3PhoneIn, orgChild3Fax: requestBody.orgChild3Fax, diff --git a/src/controllers/OrgChild4Controller.ts b/src/controllers/OrgChild4Controller.ts index eb044bbc..4dac9e82 100644 --- a/src/controllers/OrgChild4Controller.ts +++ b/src/controllers/OrgChild4Controller.ts @@ -82,6 +82,10 @@ export class OrgChild4Controller extends Controller { DIVISION_CODE: orgChild4.DIVISION_CODE, SECTION_CODE: orgChild4.SECTION_CODE, JOB_CODE: orgChild4.JOB_CODE, + ROOT_CODE: orgChild4.ROOT_CODE, + CHILD1_CODE: orgChild4.CHILD1_CODE, + CHILD2_CODE: orgChild4.CHILD2_CODE, + CHILD3_CODE: orgChild4.CHILD3_CODE, CHILD4_CODE: orgChild4.CHILD4_CODE, orgCode: orgChild4.orgRoot.orgRootCode + orgChild4.orgChild4Code, }; @@ -255,6 +259,10 @@ export class OrgChild4Controller extends Controller { DIVISION_CODE: requestBody.DIVISION_CODE != null ? requestBody.DIVISION_CODE : _null, SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null, JOB_CODE: requestBody.JOB_CODE != null ? requestBody.JOB_CODE : _null, + ROOT_CODE: requestBody.ROOT_CODE != null ? requestBody.ROOT_CODE : _null, + CHILD1_CODE: requestBody.CHILD1_CODE != null ? requestBody.CHILD1_CODE : _null, + CHILD2_CODE: requestBody.CHILD2_CODE != null ? requestBody.CHILD2_CODE : _null, + CHILD3_CODE: requestBody.CHILD3_CODE != null ? requestBody.CHILD3_CODE : _null, CHILD4_CODE: requestBody.CHILD4_CODE != null ? requestBody.CHILD4_CODE : _null, orgChild4PhoneEx: requestBody.orgChild4PhoneEx, orgChild4PhoneIn: requestBody.orgChild4PhoneIn, diff --git a/src/controllers/OrgRootController.ts b/src/controllers/OrgRootController.ts index 69c5bba8..97f3f6a3 100644 --- a/src/controllers/OrgRootController.ts +++ b/src/controllers/OrgRootController.ts @@ -84,6 +84,10 @@ export class OrgRootController extends Controller { SECTION_CODE: orgRoot.SECTION_CODE, JOB_CODE: orgRoot.JOB_CODE, ROOT_CODE: orgRoot.ROOT_CODE, + CHILD1_CODE: orgRoot.CHILD1_CODE, + CHILD2_CODE: orgRoot.CHILD2_CODE, + CHILD3_CODE: orgRoot.CHILD3_CODE, + CHILD4_CODE: orgRoot.CHILD4_CODE, orgCode: orgRoot.orgRootCode + "00", }; return new HttpSuccess(getOrgRoot); @@ -352,6 +356,10 @@ export class OrgRootController extends Controller { SECTION_CODE: requestBody.SECTION_CODE != null ? requestBody.SECTION_CODE : _null, JOB_CODE: requestBody.JOB_CODE != null ? requestBody.JOB_CODE : _null, ROOT_CODE: requestBody.ROOT_CODE != null ? requestBody.ROOT_CODE : _null, + CHILD1_CODE: requestBody.CHILD1_CODE != null ? requestBody.CHILD1_CODE : _null, + CHILD2_CODE: requestBody.CHILD2_CODE != null ? requestBody.CHILD2_CODE : _null, + CHILD3_CODE: requestBody.CHILD3_CODE != null ? requestBody.CHILD3_CODE : _null, + CHILD4_CODE: requestBody.CHILD4_CODE != null ? requestBody.CHILD4_CODE : _null, }); await this.orgRootRepository.save(orgRoot, { data: request }); setLogDataDiff(request, { before, after: orgRoot }); diff --git a/src/entities/OrgChild1.ts b/src/entities/OrgChild1.ts index b211acf8..ef2a9be6 100644 --- a/src/entities/OrgChild1.ts +++ b/src/entities/OrgChild1.ts @@ -174,6 +174,14 @@ export class OrgChild1 extends EntityBase { }) JOB_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "ROOT_CODE", + default: null, + }) + ROOT_CODE: string; + @Column({ nullable: true, length: 3, @@ -182,6 +190,30 @@ export class OrgChild1 extends EntityBase { }) CHILD1_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "CHILD2_CODE", + default: null, + }) + CHILD2_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD3_CODE", + default: null, + }) + CHILD3_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD4_CODE", + default: null, + }) + CHILD4_CODE: string; + @ManyToOne(() => OrgRoot, (orgRoot) => orgRoot.orgChild1s) @JoinColumn({ name: "orgRootId" }) orgRoot: OrgRoot; @@ -236,9 +268,21 @@ export class CreateOrgChild1 { @Column() JOB_CODE?: string | null; + @Column() + ROOT_CODE?: string | null; + @Column() CHILD1_CODE?: string | null; + @Column() + CHILD2_CODE?: string | null; + + @Column() + CHILD3_CODE?: string | null; + + @Column() + CHILD4_CODE?: string | null; + @Column() orgChild1PhoneEx?: string; @@ -294,9 +338,21 @@ export class UpdateOrgChild1 { @Column() JOB_CODE?: string | null; + @Column() + ROOT_CODE?: string | null; + @Column() CHILD1_CODE?: string | null; + @Column() + CHILD2_CODE?: string | null; + + @Column() + CHILD3_CODE?: string | null; + + @Column() + CHILD4_CODE?: string | null; + @Column() orgChild1PhoneEx?: string; diff --git a/src/entities/OrgChild2.ts b/src/entities/OrgChild2.ts index 1abf8b61..50f40769 100644 --- a/src/entities/OrgChild2.ts +++ b/src/entities/OrgChild2.ts @@ -146,6 +146,22 @@ export class OrgChild2 extends EntityBase { }) JOB_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "ROOT_CODE", + default: null, + }) + ROOT_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD1_CODE", + default: null, + }) + CHILD1_CODE: string; + @Column({ nullable: true, length: 3, @@ -154,6 +170,22 @@ export class OrgChild2 extends EntityBase { }) CHILD2_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "CHILD3_CODE", + default: null, + }) + CHILD3_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD4_CODE", + default: null, + }) + CHILD4_CODE: string; + @Column({ nullable: true, length: 40, @@ -230,9 +262,21 @@ export class CreateOrgChild2 { @Column() JOB_CODE?: string; + @Column() + ROOT_CODE?: string; + + @Column() + CHILD1_CODE?: string; + @Column() CHILD2_CODE?: string; + @Column() + CHILD3_CODE?: string; + + @Column() + CHILD4_CODE?: string; + @Column() orgChild2PhoneEx?: string; @@ -280,9 +324,21 @@ export class UpdateOrgChild2 { @Column() JOB_CODE?: string | null; + @Column() + ROOT_CODE?: string | null; + + @Column() + CHILD1_CODE?: string | null; + @Column() CHILD2_CODE?: string | null; + @Column() + CHILD3_CODE?: string | null; + + @Column() + CHILD4_CODE?: string | null; + @Column() orgChild2PhoneEx?: string; diff --git a/src/entities/OrgChild3.ts b/src/entities/OrgChild3.ts index 6fbc1e72..72a29336 100644 --- a/src/entities/OrgChild3.ts +++ b/src/entities/OrgChild3.ts @@ -153,6 +153,30 @@ export class OrgChild3 extends EntityBase { }) JOB_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "ROOT_CODE", + default: null, + }) + ROOT_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD1_CODE", + default: null, + }) + CHILD1_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD2_CODE", + default: null, + }) + CHILD2_CODE: string; + @Column({ nullable: true, length: 3, @@ -161,6 +185,14 @@ export class OrgChild3 extends EntityBase { }) CHILD3_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "CHILD4_CODE", + default: null, + }) + CHILD4_CODE: string; + @Column({ nullable: true, length: 40, @@ -238,9 +270,21 @@ export class CreateOrgChild3 { @Column() JOB_CODE?: string; + @Column() + ROOT_CODE?: string; + + @Column() + CHILD1_CODE?: string; + + @Column() + CHILD2_CODE?: string; + @Column() CHILD3_CODE?: string; + @Column() + CHILD4_CODE?: string; + @Column() orgChild3PhoneEx?: string; @@ -290,9 +334,21 @@ export class UpdateOrgChild3 { @Column() JOB_CODE?: string | null; + @Column() + ROOT_CODE?: string | null; + + @Column() + CHILD1_CODE?: string | null; + + @Column() + CHILD2_CODE?: string | null; + @Column() CHILD3_CODE?: string | null; + @Column() + CHILD4_CODE?: string | null; + @Column() orgChild3PhoneEx?: string; diff --git a/src/entities/OrgChild4.ts b/src/entities/OrgChild4.ts index d0a28a27..4f053b00 100644 --- a/src/entities/OrgChild4.ts +++ b/src/entities/OrgChild4.ts @@ -158,6 +158,38 @@ export class OrgChild4 extends EntityBase { }) JOB_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "ROOT_CODE", + default: null, + }) + ROOT_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD1_CODE", + default: null, + }) + CHILD1_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD2_CODE", + default: null, + }) + CHILD2_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD3_CODE", + default: null, + }) + CHILD3_CODE: string; + @Column({ nullable: true, length: 3, @@ -244,6 +276,18 @@ export class CreateOrgChild4 { @Column() JOB_CODE?: string; + @Column() + ROOT_CODE?: string; + + @Column() + CHILD1_CODE?: string; + + @Column() + CHILD2_CODE?: string; + + @Column() + CHILD3_CODE?: string; + @Column() CHILD4_CODE?: string; @@ -294,6 +338,18 @@ export class UpdateOrgChild4 { @Column() JOB_CODE?: string | null; + @Column() + ROOT_CODE?: string | null; + + @Column() + CHILD1_CODE?: string | null; + + @Column() + CHILD2_CODE?: string | null; + + @Column() + CHILD3_CODE?: string | null; + @Column() CHILD4_CODE?: string | null; diff --git a/src/entities/OrgRoot.ts b/src/entities/OrgRoot.ts index d474a1fe..02e22bb8 100644 --- a/src/entities/OrgRoot.ts +++ b/src/entities/OrgRoot.ts @@ -174,6 +174,38 @@ export class OrgRoot extends EntityBase { }) ROOT_CODE: string; + @Column({ + nullable: true, + length: 3, + comment: "CHILD1_CODE", + default: null, + }) + CHILD1_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD2_CODE", + default: null, + }) + CHILD2_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD3_CODE", + default: null, + }) + CHILD3_CODE: string; + + @Column({ + nullable: true, + length: 3, + comment: "CHILD4_CODE", + default: null, + }) + CHILD4_CODE: string; + @ManyToOne(() => OrgRevision, (orgRevision) => orgRevision.orgRoots) @JoinColumn({ name: "orgRevisionId" }) orgRevision: OrgRevision; @@ -237,6 +269,18 @@ export class CreateOrgRoot { @Column() ROOT_CODE?: string; + @Column() + CHILD1_CODE?: string; + + @Column() + CHILD2_CODE?: string; + + @Column() + CHILD3_CODE?: string; + + @Column() + CHILD4_CODE?: string; + @Column() orgRootPhoneEx?: string; @@ -295,6 +339,18 @@ export class UpdateOrgRoot { @Column() ROOT_CODE?: string | null; + @Column() + CHILD1_CODE?: string | null; + + @Column() + CHILD2_CODE?: string | null; + + @Column() + CHILD3_CODE?: string | null; + + @Column() + CHILD4_CODE?: string | null; + @Column() orgRootPhoneEx?: string; diff --git a/src/migration/1781577597453-update_add_field_code_all_tables.ts b/src/migration/1781577597453-update_add_field_code_all_tables.ts new file mode 100644 index 00000000..39ea6466 --- /dev/null +++ b/src/migration/1781577597453-update_add_field_code_all_tables.ts @@ -0,0 +1,51 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateAddFieldCodeAllTables1781577597453 implements MigrationInterface { + name = 'UpdateAddFieldCodeAllTables1781577597453' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`ROOT_CODE\` varchar(3) NULL COMMENT 'ROOT_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`CHILD1_CODE\` varchar(3) NULL COMMENT 'CHILD1_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`CHILD2_CODE\` varchar(3) NULL COMMENT 'CHILD2_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild4\` ADD \`CHILD3_CODE\` varchar(3) NULL COMMENT 'CHILD3_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`ROOT_CODE\` varchar(3) NULL COMMENT 'ROOT_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`CHILD1_CODE\` varchar(3) NULL COMMENT 'CHILD1_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`CHILD2_CODE\` varchar(3) NULL COMMENT 'CHILD2_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild3\` ADD \`CHILD4_CODE\` varchar(3) NULL COMMENT 'CHILD4_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`ROOT_CODE\` varchar(3) NULL COMMENT 'ROOT_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`CHILD1_CODE\` varchar(3) NULL COMMENT 'CHILD1_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`CHILD3_CODE\` varchar(3) NULL COMMENT 'CHILD3_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild2\` ADD \`CHILD4_CODE\` varchar(3) NULL COMMENT 'CHILD4_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`ROOT_CODE\` varchar(3) NULL COMMENT 'ROOT_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`CHILD2_CODE\` varchar(3) NULL COMMENT 'CHILD2_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`CHILD3_CODE\` varchar(3) NULL COMMENT 'CHILD3_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgChild1\` ADD \`CHILD4_CODE\` varchar(3) NULL COMMENT 'CHILD4_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`CHILD1_CODE\` varchar(3) NULL COMMENT 'CHILD1_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`CHILD2_CODE\` varchar(3) NULL COMMENT 'CHILD2_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`CHILD3_CODE\` varchar(3) NULL COMMENT 'CHILD3_CODE'`); + await queryRunner.query(`ALTER TABLE \`orgRoot\` ADD \`CHILD4_CODE\` varchar(3) NULL COMMENT 'CHILD4_CODE'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`CHILD4_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`CHILD3_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`CHILD2_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgRoot\` DROP COLUMN \`CHILD1_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`CHILD4_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`CHILD3_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`CHILD2_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild1\` DROP COLUMN \`ROOT_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`CHILD4_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`CHILD3_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`CHILD1_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild2\` DROP COLUMN \`ROOT_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`CHILD4_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`CHILD2_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`CHILD1_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild3\` DROP COLUMN \`ROOT_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`CHILD3_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`CHILD2_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`CHILD1_CODE\``); + await queryRunner.query(`ALTER TABLE \`orgChild4\` DROP COLUMN \`ROOT_CODE\``); + } +} From e84f93f6db076a432d9082942824d95531d81b85 Mon Sep 17 00:00:00 2001 From: harid Date: Tue, 16 Jun 2026 10:25:45 +0700 Subject: [PATCH 2/2] fix #252 --- src/controllers/OrganizationController.ts | 50 +++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/controllers/OrganizationController.ts b/src/controllers/OrganizationController.ts index 096c7111..7063964a 100644 --- a/src/controllers/OrganizationController.ts +++ b/src/controllers/OrganizationController.ts @@ -1747,6 +1747,11 @@ export class OrganizationController extends Controller { "orgRoot.DIVISION_CODE", "orgRoot.SECTION_CODE", "orgRoot.JOB_CODE", + "orgRoot.ROOT_CODE", + "orgRoot.CHILD1_CODE", + "orgRoot.CHILD2_CODE", + "orgRoot.CHILD3_CODE", + "orgRoot.CHILD4_CODE", "orgRoot.responsibility", ]) .orderBy("orgRoot.orgRootOrder", "ASC") @@ -1786,6 +1791,11 @@ export class OrganizationController extends Controller { "orgChild1.DIVISION_CODE", "orgChild1.SECTION_CODE", "orgChild1.JOB_CODE", + "orgChild1.ROOT_CODE", + "orgChild1.CHILD1_CODE", + "orgChild1.CHILD2_CODE", + "orgChild1.CHILD3_CODE", + "orgChild1.CHILD4_CODE", "orgChild1.responsibility", ]) .orderBy("orgChild1.orgChild1Order", "ASC") @@ -1825,6 +1835,11 @@ export class OrganizationController extends Controller { "orgChild2.DIVISION_CODE", "orgChild2.SECTION_CODE", "orgChild2.JOB_CODE", + "orgChild2.ROOT_CODE", + "orgChild2.CHILD1_CODE", + "orgChild2.CHILD2_CODE", + "orgChild2.CHILD3_CODE", + "orgChild2.CHILD4_CODE", "orgChild2.orgChild1Id", "orgChild2.responsibility", ]) @@ -1865,6 +1880,11 @@ export class OrganizationController extends Controller { "orgChild3.DIVISION_CODE", "orgChild3.SECTION_CODE", "orgChild3.JOB_CODE", + "orgChild3.ROOT_CODE", + "orgChild3.CHILD1_CODE", + "orgChild3.CHILD2_CODE", + "orgChild3.CHILD3_CODE", + "orgChild3.CHILD4_CODE", "orgChild3.orgChild2Id", "orgChild3.responsibility", ]) @@ -1905,6 +1925,11 @@ export class OrganizationController extends Controller { "orgChild4.DIVISION_CODE", "orgChild4.SECTION_CODE", "orgChild4.JOB_CODE", + "orgChild4.ROOT_CODE", + "orgChild4.CHILD1_CODE", + "orgChild4.CHILD2_CODE", + "orgChild4.CHILD3_CODE", + "orgChild4.CHILD4_CODE", "orgChild4.orgChild3Id", "orgChild4.responsibility", ]) @@ -1930,6 +1955,11 @@ export class OrganizationController extends Controller { DIVISION_CODE: orgRoot.DIVISION_CODE, SECTION_CODE: orgRoot.SECTION_CODE, JOB_CODE: orgRoot.JOB_CODE, + ROOT_CODE: orgRoot.ROOT_CODE, + CHILD1_CODE: orgRoot.CHILD1_CODE, + CHILD2_CODE: orgRoot.CHILD2_CODE, + CHILD3_CODE: orgRoot.CHILD3_CODE, + CHILD4_CODE: orgRoot.CHILD4_CODE, orgTreeOrder: orgRoot.orgRootOrder, orgTreePhoneEx: orgRoot.orgRootPhoneEx, orgTreePhoneIn: orgRoot.orgRootPhoneIn, @@ -1961,6 +1991,11 @@ export class OrganizationController extends Controller { DIVISION_CODE: orgChild1.DIVISION_CODE, SECTION_CODE: orgChild1.SECTION_CODE, JOB_CODE: orgChild1.JOB_CODE, + ROOT_CODE: orgChild1.ROOT_CODE, + CHILD1_CODE: orgChild1.CHILD1_CODE, + CHILD2_CODE: orgChild1.CHILD2_CODE, + CHILD3_CODE: orgChild1.CHILD3_CODE, + CHILD4_CODE: orgChild1.CHILD4_CODE, orgTreeOrder: orgChild1.orgChild1Order, orgRootCode: orgRoot.orgRootCode, orgTreePhoneEx: orgChild1.orgChild1PhoneEx, @@ -2005,6 +2040,11 @@ export class OrganizationController extends Controller { DIVISION_CODE: orgChild2.DIVISION_CODE, SECTION_CODE: orgChild2.SECTION_CODE, JOB_CODE: orgChild2.JOB_CODE, + ROOT_CODE: orgChild2.ROOT_CODE, + CHILD1_CODE: orgChild2.CHILD1_CODE, + CHILD2_CODE: orgChild2.CHILD2_CODE, + CHILD3_CODE: orgChild2.CHILD3_CODE, + CHILD4_CODE: orgChild2.CHILD4_CODE, orgTreeOrder: orgChild2.orgChild2Order, orgRootCode: orgRoot.orgRootCode, orgTreePhoneEx: orgChild2.orgChild2PhoneEx, @@ -2054,6 +2094,11 @@ export class OrganizationController extends Controller { DIVISION_CODE: orgChild3.DIVISION_CODE, SECTION_CODE: orgChild3.SECTION_CODE, JOB_CODE: orgChild3.JOB_CODE, + ROOT_CODE: orgChild3.ROOT_CODE, + CHILD1_CODE: orgChild3.CHILD1_CODE, + CHILD2_CODE: orgChild3.CHILD2_CODE, + CHILD3_CODE: orgChild3.CHILD3_CODE, + CHILD4_CODE: orgChild3.CHILD4_CODE, orgTreeOrder: orgChild3.orgChild3Order, orgRootCode: orgRoot.orgRootCode, orgTreePhoneEx: orgChild3.orgChild3PhoneEx, @@ -2110,6 +2155,11 @@ export class OrganizationController extends Controller { DIVISION_CODE: orgChild4.DIVISION_CODE, SECTION_CODE: orgChild4.SECTION_CODE, JOB_CODE: orgChild4.JOB_CODE, + ROOT_CODE: orgChild4.ROOT_CODE, + CHILD1_CODE: orgChild4.CHILD1_CODE, + CHILD2_CODE: orgChild4.CHILD2_CODE, + CHILD3_CODE: orgChild4.CHILD3_CODE, + CHILD4_CODE: orgChild4.CHILD4_CODE, orgTreeOrder: orgChild4.orgChild4Order, orgRootCode: orgRoot.orgRootCode, orgTreePhoneEx: orgChild4.orgChild4PhoneEx,