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\``); + } + +}