Migrate #2481
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m3s

This commit is contained in:
harid 2026-06-05 12:04:52 +07:00
parent 825263c11c
commit 8bd4a816e8
4 changed files with 33 additions and 0 deletions

View file

@ -5594,6 +5594,7 @@ export class CommandController extends Controller {
date: item.commandDateAffect,
refCommandDate: item.commandDateSign,
refCommandNo: `${item.commandNo}/${item.commandYear}`,
refCommandId: item.commandId,
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
@ -6117,6 +6118,7 @@ export class CommandController extends Controller {
date: item.commandDateAffect,
refCommandDate: item.commandDateSign,
refCommandNo: `${item.commandNo}/${item.commandYear}`,
refCommandId: item.commandId,
profileEmployeeId: item.profileId,
profileId: undefined,
});

View file

@ -62,6 +62,14 @@ export class ProfileDiscipline extends EntityBase {
})
refCommandNo: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง command",
default: null,
})
refCommandId: string;
@Column({
nullable: true,
comment: "ล้างมลทิน",

View file

@ -51,6 +51,14 @@ export class ProfileDisciplineHistory extends EntityBase {
})
refCommandNo: string;
@Column({
nullable: true,
length: 40,
comment: "คีย์นอก(FK)ของตาราง command",
default: null,
})
refCommandId: string;
@Column({
nullable: true,
comment: "ล้างมลทิน",

View file

@ -0,0 +1,15 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateProfileDisciplineAddRefCommandId1780634210221 implements MigrationInterface {
name = 'UpdateProfileDisciplineAddRefCommandId1780634210221'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` ADD \`refCommandId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง command'`);
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` ADD \`refCommandId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง command'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileDiscipline\` DROP COLUMN \`refCommandId\``);
await queryRunner.query(`ALTER TABLE \`profileDisciplineHistory\` DROP COLUMN \`refCommandId\``);
}
}