migrate & เพิ่มฟิลด์

This commit is contained in:
Bright 2025-04-22 16:27:56 +07:00
parent 8c7cbef72b
commit 588178f042
3 changed files with 21 additions and 4 deletions

View file

@ -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);
}

View file

@ -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;
}

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableDevelopScholashipEditType1745313881448 implements MigrationInterface {
name = 'UpdateTableDevelopScholashipEditType1745313881448'
public async up(queryRunner: QueryRunner): Promise<void> {
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<void> {
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` DROP COLUMN \`budgetSourceOther\``);
await queryRunner.query(`ALTER TABLE \`developmentScholarship\` ADD \`budgetSourceOther\` int NULL COMMENT 'เงินอื่นๆ'`);
}
}