From 588178f042016a0a5d645521991c32981287868e Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 22 Apr 2025 16:27:56 +0700 Subject: [PATCH] =?UTF-8?q?migrate=20&=20=E0=B9=80=E0=B8=9E=E0=B8=B4?= =?UTF-8?q?=E0=B9=88=E0=B8=A1=E0=B8=9F=E0=B8=B4=E0=B8=A5=E0=B8=94=E0=B9=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DevelopmentScholarshipController.ts | 1 + src/entities/DevelopmentScholarship.ts | 8 ++++---- ...8-update_table_developScholaship_edit_type.ts | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 src/migration/1745313881448-update_table_developScholaship_edit_type.ts diff --git a/src/controllers/DevelopmentScholarshipController.ts b/src/controllers/DevelopmentScholarshipController.ts index 54bead1..d3df7e8 100644 --- a/src/controllers/DevelopmentScholarshipController.ts +++ b/src/controllers/DevelopmentScholarshipController.ts @@ -519,6 +519,7 @@ export class DevelopmentScholarshipController extends Controller { profileId: getDevelopment.profileId ? getDevelopment.profileId : null, planType: getDevelopment.planType ? getDevelopment.planType : null, isNoUseBudget: getDevelopment.isNoUseBudget ? getDevelopment.isNoUseBudget : null, + budgetSourceOther: getDevelopment.budgetSourceOther ? getDevelopment.budgetSourceOther : null, }; return new HttpSuccess(formattedData); } diff --git a/src/entities/DevelopmentScholarship.ts b/src/entities/DevelopmentScholarship.ts index c0ef3cf..976598e 100644 --- a/src/entities/DevelopmentScholarship.ts +++ b/src/entities/DevelopmentScholarship.ts @@ -573,7 +573,7 @@ export class DevelopmentScholarship extends EntityBase { comment: "เงินอื่นๆ", default: null, }) - budgetSourceOther: number; + budgetSourceOther: string; } export class CreateDevelopmentScholarship { rootId: string | null; @@ -638,7 +638,7 @@ export class CreateDevelopmentScholarship { totalPeriod: string | null; planType: string | null; isNoUseBudget: boolean | null; - budgetSourceOther?: number | null; + budgetSourceOther?: string | null; } export class UpdateDevelopmentScholarship { @@ -704,7 +704,7 @@ export class UpdateDevelopmentScholarship { totalPeriod: string | null; planType: string | null; isNoUseBudget: boolean | null; - budgetSourceOther?: number | null; + budgetSourceOther?: string | null; } export class UpdateDevelopmentScholarshipUser { @@ -715,5 +715,5 @@ export class UpdateDevelopmentScholarshipUser { isGraduated: boolean | null; graduatedDate: Date | null; graduatedReason: string | null; - budgetSourceOther?: number | null; + budgetSourceOther?: string | null; } diff --git a/src/migration/1745313881448-update_table_developScholaship_edit_type.ts b/src/migration/1745313881448-update_table_developScholaship_edit_type.ts new file mode 100644 index 0000000..c6c393f --- /dev/null +++ b/src/migration/1745313881448-update_table_developScholaship_edit_type.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableDevelopScholashipEditType1745313881448 implements MigrationInterface { + name = 'UpdateTableDevelopScholashipEditType1745313881448' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`budgetSourceOther\``); + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`budgetSourceOther\` varchar(255) NULL COMMENT 'เงินอื่นๆ'`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`budgetSourceOther\``); + await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`budgetSourceOther\` int NULL COMMENT 'เงินอื่นๆ'`); + } + +}