From d5252ee4b3eafbfd09d14c6bbe843ae5972af383 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 7 May 2024 10:17:19 +0700 Subject: [PATCH] =?UTF-8?q?=E0=B9=80=E0=B8=9E=E0=B8=B4=E0=B9=88=E0=B8=A1?= =?UTF-8?q?=E0=B8=9B=E0=B8=B5=E0=B8=A3=E0=B8=AD=E0=B8=9A=E0=B8=95=E0=B8=B1?= =?UTF-8?q?=E0=B8=A7=E0=B8=8A=E0=B8=B5=E0=B9=89=E0=B8=A7=E0=B8=B1=E0=B8=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/kpiPlan.ts | 14 +++++++++++++ src/entities/kpiRole.ts | 15 +++++++++++++- ...051771366-update_table_kpiPlan_add_year.ts | 20 +++++++++++++++++++ 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 src/migration/1715051771366-update_table_kpiPlan_add_year.ts diff --git a/src/entities/kpiPlan.ts b/src/entities/kpiPlan.ts index 962c3cc..192b474 100644 --- a/src/entities/kpiPlan.ts +++ b/src/entities/kpiPlan.ts @@ -7,6 +7,20 @@ import { KpiPlanHistory } from "./kpiPlanHistory"; @Entity("kpiPlan") export class KpiPlan extends EntityBase { + @Column({ + nullable: true, + comment: "รอบ", + default: null, + }) + period: string; + + @Column({ + nullable: true, + comment: "ปี", + default: null, + }) + year: string; + @Column({ nullable: true, comment: "ลำดับ/รหัสตัวชี้วัด", diff --git a/src/entities/kpiRole.ts b/src/entities/kpiRole.ts index 86fa42e..ada9781 100644 --- a/src/entities/kpiRole.ts +++ b/src/entities/kpiRole.ts @@ -6,6 +6,20 @@ import { KpiRoleHistory } from "./kpiRoleHistory"; @Entity("kpiRole") export class KpiRole extends EntityBase { + @Column({ + nullable: true, + comment: "รอบ", + default: null, + }) + period: string; + + @Column({ + nullable: true, + comment: "ปี", + default: null, + }) + year: string; + @Column({ nullable: true, comment: "ตำแหน่ง", @@ -224,7 +238,6 @@ export class KpiRole extends EntityBase { }) documentInfoEvidence: string; - @ManyToOne(() => KpiPeriod, (kpiPeriod) => kpiPeriod.kpiRoles) @JoinColumn({ name: "kpiPeriodId" }) kpiPeriod: KpiPeriod; diff --git a/src/migration/1715051771366-update_table_kpiPlan_add_year.ts b/src/migration/1715051771366-update_table_kpiPlan_add_year.ts new file mode 100644 index 0000000..de36432 --- /dev/null +++ b/src/migration/1715051771366-update_table_kpiPlan_add_year.ts @@ -0,0 +1,20 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableKpiPlanAddYear1715051771366 implements MigrationInterface { + name = 'UpdateTableKpiPlanAddYear1715051771366' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`period\` varchar(255) NULL COMMENT 'รอบ'`); + await queryRunner.query(`ALTER TABLE \`kpiPlan\` ADD \`year\` varchar(255) NULL COMMENT 'ปี'`); + await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`period\` varchar(255) NULL COMMENT 'รอบ'`); + await queryRunner.query(`ALTER TABLE \`kpiRole\` ADD \`year\` varchar(255) NULL COMMENT 'ปี'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`year\``); + await queryRunner.query(`ALTER TABLE \`kpiRole\` DROP COLUMN \`period\``); + await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`year\``); + await queryRunner.query(`ALTER TABLE \`kpiPlan\` DROP COLUMN \`period\``); + } + +}