From 092d8e2e187b5d61d1404ec83349b8187e38e3a2 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Tue, 27 Feb 2024 10:09:06 +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=9F=E0=B8=B4=E0=B8=A7=E0=B8=87=E0=B8=9A=E0=B8=A3=E0=B8=B0?= =?UTF-8?q?=E0=B8=A1=E0=B8=B2=E0=B8=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/entities/SalaryPeriod.ts | 6 ++++++ ...003297171-update_table_salaryPeriod_add_year.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/migration/1709003297171-update_table_salaryPeriod_add_year.ts diff --git a/src/entities/SalaryPeriod.ts b/src/entities/SalaryPeriod.ts index 080afb6..aafa67a 100644 --- a/src/entities/SalaryPeriod.ts +++ b/src/entities/SalaryPeriod.ts @@ -30,6 +30,12 @@ export class SalaryPeriod extends EntityBase { }) status?: string; + @Column({ + nullable: true, + comment: "ปีงบหระมาณ", + }) + year: number; + @OneToMany(() => SalaryOrg, (salaryOrg) => salaryOrg.salaryPeriod) salaryOrgs: SalaryOrg[]; } diff --git a/src/migration/1709003297171-update_table_salaryPeriod_add_year.ts b/src/migration/1709003297171-update_table_salaryPeriod_add_year.ts new file mode 100644 index 0000000..ccab02f --- /dev/null +++ b/src/migration/1709003297171-update_table_salaryPeriod_add_year.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableSalaryPeriodAddYear1709003297171 implements MigrationInterface { + name = 'UpdateTableSalaryPeriodAddYear1709003297171' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryPeriod\` ADD \`year\` int NULL COMMENT 'ปีงบหระมาณ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`salaryPeriod\` DROP COLUMN \`year\``); + } + +}