From 072d9a6880d2b49f746412e7a347b48449ba7187 Mon Sep 17 00:00:00 2001 From: harid Date: Thu, 27 Nov 2025 19:28:38 +0700 Subject: [PATCH] migrate #2043 --- src/controllers/EducationLevelController.ts | 4 ++++ src/entities/EducationLevel.ts | 21 +++++++++++++++++++ ...-update_table_educationLeave_add_fields.ts | 16 ++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 src/migration/1764244579743-update_table_educationLeave_add_fields.ts diff --git a/src/controllers/EducationLevelController.ts b/src/controllers/EducationLevelController.ts index eecdbda0..f99214a9 100644 --- a/src/controllers/EducationLevelController.ts +++ b/src/controllers/EducationLevelController.ts @@ -132,6 +132,8 @@ export class EducationLevelController extends Controller { "id", "name", "rank", + "educationLevel", + "isHigh", "createdAt", "lastUpdatedAt", "createdFullName", @@ -157,6 +159,8 @@ export class EducationLevelController extends Controller { "id", "name", "rank", + "educationLevel", + "isHigh", "createdAt", "lastUpdatedAt", "createdFullName", diff --git a/src/entities/EducationLevel.ts b/src/entities/EducationLevel.ts index 631c5a9d..cc291e90 100644 --- a/src/entities/EducationLevel.ts +++ b/src/entities/EducationLevel.ts @@ -17,6 +17,21 @@ export class EducationLevel extends EntityBase { default: null, }) rank: number; + + @Column({ + nullable: true, + comment: "ขีดจำกัดวุฒิการศึกษา", + length: 50, + default: null, + }) + educationLevel?: string; + + @Column({ + nullable: true, + comment: "วุฒิการศึกษาสูงสุด", + default: null, + }) + isHigh?: boolean; } export class CreateEducationLevel { @@ -25,6 +40,12 @@ export class CreateEducationLevel { @Column() rank: number; + + @Column() + educationLevel?: string; + + @Column() + isHigh?: boolean; } export type UpdateEducationLevel = Partial; diff --git a/src/migration/1764244579743-update_table_educationLeave_add_fields.ts b/src/migration/1764244579743-update_table_educationLeave_add_fields.ts new file mode 100644 index 00000000..0453ff63 --- /dev/null +++ b/src/migration/1764244579743-update_table_educationLeave_add_fields.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableEducationLeaveAddFields1764244579743 implements MigrationInterface { + name = 'UpdateTableEducationLeaveAddFields1764244579743' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`educationLevel\` ADD \`educationLevel\` varchar(50) NULL COMMENT 'ขีดจำกัดวุฒิการศึกษา'`); + await queryRunner.query(`ALTER TABLE \`educationLevel\` ADD \`isHigh\` tinyint NULL COMMENT 'วุฒิการศึกษาสูงสุด'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`educationLevel\` DROP COLUMN \`isHigh\``); + await queryRunner.query(`ALTER TABLE \`educationLevel\` DROP COLUMN \`educationLevel\``); + } + +}