diff --git a/src/controllers/DevelopmentController.ts b/src/controllers/DevelopmentController.ts index 4310ce9..82c6d93 100644 --- a/src/controllers/DevelopmentController.ts +++ b/src/controllers/DevelopmentController.ts @@ -370,44 +370,44 @@ export class DevelopmentController extends Controller { await Promise.all( requestBody.positions.map(async (x) => { const _data = Object.assign(new PlannedGoalPosition(), x); - if (x.posTypePlannedId != null) { - let checkId:any - if(requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { - checkId = await this.empPosTypeRepository.findOne({ - where: { id: x.posTypePlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกลุ่มงาน"); - } - } - else { - checkId = await this.posTypeRepository.findOne({ - where: { id: x.posTypePlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); - } - } - } - if (x.posLevelPlannedId != null) { - let checkId:any - if (requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { - checkId = await this.empPosLevelRepository.findOne({ - where: { id: x.posLevelPlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับชั้นงาน"); - } - } - else { - checkId = await this.posLevelRepository.findOne({ - where: { id: x.posLevelPlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); - } - } - } + // if (x.posTypePlannedId != null) { + // let checkId:any + // if(requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { + // checkId = await this.empPosTypeRepository.findOne({ + // where: { id: x.posTypePlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกลุ่มงาน"); + // } + // } + // else { + // checkId = await this.posTypeRepository.findOne({ + // where: { id: x.posTypePlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); + // } + // } + // } + // if (x.posLevelPlannedId != null) { + // let checkId:any + // if (requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { + // checkId = await this.empPosLevelRepository.findOne({ + // where: { id: x.posLevelPlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับชั้นงาน"); + // } + // } + // else { + // checkId = await this.posLevelRepository.findOne({ + // where: { id: x.posLevelPlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); + // } + // } + // } const before = structuredClone(development); _data.createdUserId = request.user.sub; _data.createdFullName = request.user.name; @@ -492,32 +492,32 @@ export class DevelopmentController extends Controller { if (!development) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้"); } - if (requestBody.posTypeActualId != null) { - // addLogSequence(request, { - // action: "database", - // status: "success", - // description: "Get Position Type.", - // }); - const checkId = await this.posTypeRepository.findOne({ - where: { id: requestBody.posTypeActualId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); - } - } - if (requestBody.posLevelActualId != null) { - // addLogSequence(request, { - // action: "database", - // status: "success", - // description: "Get Position Level.", - // }); - const checkId = await this.posLevelRepository.findOne({ - where: { id: requestBody.posLevelActualId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); - } - } + // if (requestBody.posTypeActualId != null) { + // // addLogSequence(request, { + // // action: "database", + // // status: "success", + // // description: "Get Position Type.", + // // }); + // const checkId = await this.posTypeRepository.findOne({ + // where: { id: requestBody.posTypeActualId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); + // } + // } + // if (requestBody.posLevelActualId != null) { + // // addLogSequence(request, { + // // action: "database", + // // status: "success", + // // description: "Get Position Level.", + // // }); + // const checkId = await this.posLevelRepository.findOne({ + // where: { id: requestBody.posLevelActualId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); + // } + // } const before = structuredClone(development); const data = Object.assign(new ActualGoal(), requestBody); data.createdUserId = request.user.sub; @@ -633,44 +633,44 @@ export class DevelopmentController extends Controller { await Promise.all( requestBody.positions.map(async (x) => { const _data = Object.assign(new PlannedGoalPosition(), x); - if (x.posTypePlannedId != null) { - let checkId:any - if(requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { - checkId = await this.empPosTypeRepository.findOne({ - where: { id: x.posTypePlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกลุ่มงาน"); - } - } - else { - checkId = await this.posTypeRepository.findOne({ - where: { id: x.posTypePlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); - } - } - } - if (x.posLevelPlannedId != null) { - let checkId:any - if (requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { - checkId = await this.empPosLevelRepository.findOne({ - where: { id: x.posLevelPlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับชั้นงาน"); - } - } - else { - checkId = await this.posLevelRepository.findOne({ - where: { id: x.posLevelPlannedId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); - } - } - } + // if (x.posTypePlannedId != null) { + // let checkId:any + // if(requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { + // checkId = await this.empPosTypeRepository.findOne({ + // where: { id: x.posTypePlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกลุ่มงาน"); + // } + // } + // else { + // checkId = await this.posTypeRepository.findOne({ + // where: { id: x.posTypePlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); + // } + // } + // } + // if (x.posLevelPlannedId != null) { + // let checkId:any + // if (requestBody.groupTarget == "PERSONNEL" && (requestBody.groupTargetSub == "EMPLOYEE" || requestBody.groupTargetSub == "EMPLOYEETEMP")) { + // checkId = await this.empPosLevelRepository.findOne({ + // where: { id: x.posLevelPlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับชั้นงาน"); + // } + // } + // else { + // checkId = await this.posLevelRepository.findOne({ + // where: { id: x.posLevelPlannedId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); + // } + // } + // } _data.createdUserId = request.user.sub; _data.createdFullName = request.user.name; _data.lastUpdateUserId = request.user.sub; @@ -759,32 +759,32 @@ export class DevelopmentController extends Controller { if (!development) { throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลโครงการ/หลักสูตรการฝึกอบรมนี้"); } - if (requestBody.posTypeActualId != null) { - // addLogSequence(request, { - // action: "database", - // status: "success", - // description: "Get Position Type.", - // }); - const checkId = await this.posTypeRepository.findOne({ - where: { id: requestBody.posTypeActualId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); - } - } - if (requestBody.posLevelActualId != null) { - // addLogSequence(request, { - // action: "database", - // status: "success", - // description: "Get Position Level.", - // }); - const checkId = await this.posLevelRepository.findOne({ - where: { id: requestBody.posLevelActualId }, - }); - if (!checkId) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); - } - } + // if (requestBody.posTypeActualId != null) { + // // addLogSequence(request, { + // // action: "database", + // // status: "success", + // // description: "Get Position Type.", + // // }); + // const checkId = await this.posTypeRepository.findOne({ + // where: { id: requestBody.posTypeActualId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทตำแหน่ง"); + // } + // } + // if (requestBody.posLevelActualId != null) { + // // addLogSequence(request, { + // // action: "database", + // // status: "success", + // // description: "Get Position Level.", + // // }); + // const checkId = await this.posLevelRepository.findOne({ + // where: { id: requestBody.posLevelActualId }, + // }); + // if (!checkId) { + // throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลระดับตำแหน่ง"); + // } + // } const before = structuredClone(development); Object.assign(development, requestBody); development.lastUpdateUserId = request.user.sub; @@ -2164,17 +2164,18 @@ export class DevelopmentController extends Controller { if (_workflow == false) await new permission().PermissionGet(request, "SYS_DEV_PROJECT"); const getDevelopment = await this.developmentRepository.findOne({ where: { id: id }, + //posTypeActual relations: [ "developmentActualPeoples", "developmentPlannedPeoples", "developmentActualGoals", - "developmentActualGoals.posTypeActual", - "developmentActualGoals.posLevelActual", + // "developmentActualGoals.posTypeActual", + // "developmentActualGoals.posLevelActual", "developmentActualGoals", "developmentPlannedGoals", "developmentPlannedGoals.plannedGoalPositions", - "developmentPlannedGoals.plannedGoalPositions.posTypePlanned", - "developmentPlannedGoals.plannedGoalPositions.posLevelPlanned", + // "developmentPlannedGoals.plannedGoalPositions.posTypePlanned", + // "developmentPlannedGoals.plannedGoalPositions.posLevelPlanned", ], }); if (!getDevelopment) { @@ -2212,10 +2213,12 @@ export class DevelopmentController extends Controller { groupTarget: x.groupTarget, groupTargetSub: x.groupTargetSub, position: x.position, - posTypeId: x.posTypeActualId, - posType: x.posTypeActual == null ? null : x.posTypeActual.posTypeName, - posLevelId: x.posLevelActualId, - posLevel: x.posLevelActual == null ? null : x.posLevelActual.posLevelName, + // posTypeId: x.posTypeActualId, + // posType: x.posTypeActual == null ? null : x.posTypeActual.posTypeName, + // posLevelId: x.posLevelActualId, + // posLevel: x.posLevelActual == null ? null : x.posLevelActual.posLevelName, + posType: x.posTypeActual, + posLevel: x.posLevelActual, type: x.type, amount: x.amount, })), @@ -2237,10 +2240,12 @@ export class DevelopmentController extends Controller { id: y.id, position: y.position, posExecutive: y.posExecutive, - posTypeId: y.posTypePlannedId, - posType: y.posTypePlanned == null ? null : y.posTypePlanned.posTypeName, - posLevelId: y.posLevelPlannedId, - posLevel: y.posLevelPlanned == null ? null : y.posLevelPlanned.posLevelName, + // posTypeId: y.posTypePlannedId, + // posType: y.posTypePlanned == null ? null : y.posTypePlanned.posTypeName, + // posLevelId: y.posLevelPlannedId, + // posLevel: y.posLevelPlanned == null ? null : y.posLevelPlanned.posLevelName, + posType: y.posTypePlanned, + posLevel: y.posLevelPlanned, })), amount: x.amount, })), diff --git a/src/entities/ActualGoal.ts b/src/entities/ActualGoal.ts index cbe85aa..2fe2589 100644 --- a/src/entities/ActualGoal.ts +++ b/src/entities/ActualGoal.ts @@ -29,25 +29,39 @@ export class ActualGoal extends EntityBase { @Column({ nullable: true, - comment: "ประเภทตำแหน่ง", + comment: "ประเภทตำแหน่ง & กลุ่มงาน", default: null, }) - posTypeActualId: string; + posTypeActual: string; + + // @Column({ + // nullable: true, + // comment: "ประเภทตำแหน่ง", + // default: null, + // }) + // posTypeActualId: string; - @ManyToOne(() => PosType, (posType: PosType) => posType.actualGoals) - @JoinColumn({ name: "posTypeActualId" }) - posTypeActual: PosType; + // @ManyToOne(() => PosType, (posType: PosType) => posType.actualGoals) + // @JoinColumn({ name: "posTypeActualId" }) + // posTypeActual: PosType; @Column({ nullable: true, - comment: "ระดับตำแหน่ง", + comment: "ระดับตำแหน่ง & ระดับชั้นงาน", default: null, }) - posLevelActualId: string; + posLevelActual: string; - @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.actualGoals) - @JoinColumn({ name: "posLevelActualId" }) - posLevelActual: PosLevel; + // @Column({ + // nullable: true, + // comment: "ระดับตำแหน่ง", + // default: null, + // }) + // posLevelActualId: string; + + // @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.actualGoals) + // @JoinColumn({ name: "posLevelActualId" }) + // posLevelActual: PosLevel; @Column({ nullable: true, @@ -82,10 +96,14 @@ export class CreateActualGoal { groupTargetSub: string | null; @Column() position: string | null; + // @Column() + // posTypeActualId: string | null; + // @Column() + // posLevelActualId: string | null; @Column() - posTypeActualId: string | null; + posTypeActual: string | null; @Column() - posLevelActualId: string | null; + posLevelActual: string | null; @Column() type: string | null; @Column() diff --git a/src/entities/PlannedGoalPosition.ts b/src/entities/PlannedGoalPosition.ts index 990c977..a5df81d 100644 --- a/src/entities/PlannedGoalPosition.ts +++ b/src/entities/PlannedGoalPosition.ts @@ -22,25 +22,39 @@ export class PlannedGoalPosition extends EntityBase { @Column({ nullable: true, - comment: "ประเภทตำแหน่ง", + comment: "ประเภทตำแหน่ง & กลุ่มงาน", default: null, }) - posTypePlannedId: string; + posTypePlanned: string; - @ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoalPositions) - @JoinColumn({ name: "posTypePlannedId" }) - posTypePlanned: PosType; + // @Column({ + // nullable: true, + // comment: "ประเภทตำแหน่ง", + // default: null, + // }) + // posTypePlannedId: string; + + // @ManyToOne(() => PosType, (posType: PosType) => posType.plannedGoalPositions) + // @JoinColumn({ name: "posTypePlannedId" }) + // posTypePlanned: PosType; @Column({ nullable: true, - comment: "ระดับตำแหน่ง", + comment: "ระดับตำแหน่ง & ระดับชั้นงาน", default: null, }) - posLevelPlannedId: string; + posLevelPlanned: string; - @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoalPositions) - @JoinColumn({ name: "posLevelPlannedId" }) - posLevelPlanned: PosLevel; + // @Column({ + // nullable: true, + // comment: "ระดับตำแหน่ง", + // default: null, + // }) + // posLevelPlannedId: string; + + // @ManyToOne(() => PosLevel, (posLevel: PosLevel) => posLevel.plannedGoalPositions) + // @JoinColumn({ name: "posLevelPlannedId" }) + // posLevelPlanned: PosLevel; @Column({ nullable: true, @@ -59,10 +73,14 @@ export class CreatePlannedGoalPosition { position: string | null; @Column() posExecutive: string | null; + // @Column() + // posTypePlannedId: string | null; + // @Column() + // posLevelPlannedId: string | null; @Column() - posTypePlannedId: string | null; + posTypePlanned: string | null; @Column() - posLevelPlannedId: string | null; + posLevelPlanned: string | null; } export type UpdatePlannedGoalPosition = Partial; diff --git a/src/entities/PosLevel.ts b/src/entities/PosLevel.ts index 705b6b8..3c686fa 100644 --- a/src/entities/PosLevel.ts +++ b/src/entities/PosLevel.ts @@ -48,14 +48,14 @@ export class PosLevel extends EntityBase { @JoinColumn({ name: "posTypeId" }) posType: PosType; - @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posLevelActual) - actualGoals: ActualGoal[]; + // @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posLevelActual) + // actualGoals: ActualGoal[]; - @OneToMany( - () => PlannedGoalPosition, - (plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posLevelPlanned, - ) - plannedGoalPositions: PlannedGoalPosition[]; + // @OneToMany( + // () => PlannedGoalPosition, + // (plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posLevelPlanned, + // ) + // plannedGoalPositions: PlannedGoalPosition[]; @OneToMany(() => DevelopmentHistory, (developmentHistory) => developmentHistory.posLevel) developmentHistorys: DevelopmentHistory[]; diff --git a/src/entities/PosType.ts b/src/entities/PosType.ts index d18e7fb..b28047b 100644 --- a/src/entities/PosType.ts +++ b/src/entities/PosType.ts @@ -28,14 +28,14 @@ export class PosType extends EntityBase { @OneToMany(() => PosLevel, (posLevel: PosLevel) => posLevel.posType) posLevels: PosLevel[]; - @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posTypeActual) - actualGoals: ActualGoal[]; + // @OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.posTypeActual) + // actualGoals: ActualGoal[]; - @OneToMany( - () => PlannedGoalPosition, - (plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posTypePlanned, - ) - plannedGoalPositions: PlannedGoalPosition[]; + // @OneToMany( + // () => PlannedGoalPosition, + // (plannedGoalPosition: PlannedGoalPosition) => plannedGoalPosition.posTypePlanned, + // ) + // plannedGoalPositions: PlannedGoalPosition[]; @OneToMany(() => DevelopmentHistory, (developmentHistory) => developmentHistory.posType) developmentHistorys: DevelopmentHistory[]; diff --git a/src/migration/1744342850196-update_table_actualGoal_and_plannedGoalPosition.ts b/src/migration/1744342850196-update_table_actualGoal_and_plannedGoalPosition.ts new file mode 100644 index 0000000..2888b6f --- /dev/null +++ b/src/migration/1744342850196-update_table_actualGoal_and_plannedGoalPosition.ts @@ -0,0 +1,36 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableActualGoalAndPlannedGoalPosition1744342850196 implements MigrationInterface { + name = 'UpdateTableActualGoalAndPlannedGoalPosition1744342850196' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP FOREIGN KEY \`FK_a9a864dd06eaa25edba8be8f24c\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP FOREIGN KEY \`FK_e08e337e5ddeb4942c72393ff58\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP FOREIGN KEY \`FK_4eef5d8c3ab92f7af4a762150a4\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP FOREIGN KEY \`FK_8e7e0bf6eebd99f58e9b47c6b05\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`posLevelActualId\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`posTypeActualId\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`posLevelPlannedId\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`posTypePlannedId\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`posTypeActual\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง & กลุ่มงาน'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`posLevelActual\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง & ระดับชั้นงาน'`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`posTypePlanned\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง & กลุ่มงาน'`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`posLevelPlanned\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง & ระดับชั้นงาน'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`posLevelPlanned\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` DROP COLUMN \`posTypePlanned\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`posLevelActual\``); + await queryRunner.query(`ALTER TABLE \`actualGoal\` DROP COLUMN \`posTypeActual\``); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`posTypePlannedId\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD \`posLevelPlannedId\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`posTypeActualId\` varchar(255) NULL COMMENT 'ประเภทตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD \`posLevelActualId\` varchar(255) NULL COMMENT 'ระดับตำแหน่ง'`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD CONSTRAINT \`FK_8e7e0bf6eebd99f58e9b47c6b05\` FOREIGN KEY (\`posLevelPlannedId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE \`plannedGoalPosition\` ADD CONSTRAINT \`FK_4eef5d8c3ab92f7af4a762150a4\` FOREIGN KEY (\`posTypePlannedId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD CONSTRAINT \`FK_e08e337e5ddeb4942c72393ff58\` FOREIGN KEY (\`posTypeActualId\`) REFERENCES \`posType\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE \`actualGoal\` ADD CONSTRAINT \`FK_a9a864dd06eaa25edba8be8f24c\` FOREIGN KEY (\`posLevelActualId\`) REFERENCES \`posLevel\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + } + +}