แก้entity nullได้้
This commit is contained in:
parent
a009da25b7
commit
2d8d35ed3d
5 changed files with 38 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne} from "typeorm";
|
||||
import { Entity, Column, OneToMany, ManyToOne } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { KpiCapacityDetail } from "./kpiCapacityDetail";
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ export class KpiCapacity extends EntityBase {
|
|||
@Column({
|
||||
nullable: true,
|
||||
comment:
|
||||
"ประเภทสมรรถนะดังนี้ HEAD = สมรรถนะหลัก, GROUP = สมรรถนะประจำกลุ่ม, EXECUTIVE = สมรรถนะประจำผู้บริหารกรุงเทพมหานคร, "+
|
||||
"ประเภทสมรรถนะดังนี้ HEAD = สมรรถนะหลัก, GROUP = สมรรถนะประจำกลุ่ม, EXECUTIVE = สมรรถนะประจำผู้บริหารกรุงเทพมหานคร, " +
|
||||
"DIRECTOR = สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ., INSPECTOR = สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ",
|
||||
type: "enum",
|
||||
enum: CapacityType,
|
||||
|
|
@ -31,14 +31,15 @@ export class KpiCapacity extends EntityBase {
|
|||
name: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "longtext",
|
||||
comment: "คำจำกัดความ",
|
||||
default: null,
|
||||
})
|
||||
description: string;
|
||||
|
||||
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacitys)
|
||||
KpiCapacityDetails: KpiCapacityDetail[];
|
||||
|
||||
}
|
||||
export class createKpiCapacity {
|
||||
@Column()
|
||||
|
|
|
|||
|
|
@ -1,19 +1,23 @@
|
|||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn} from "typeorm";
|
||||
import { Entity, Column, OneToMany, ManyToOne, JoinColumn } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { KpiCapacity } from "./kpiCapacity";
|
||||
|
||||
@Entity("kpiCapacityDetail")
|
||||
export class KpiCapacityDetail extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "longtext",
|
||||
comment: "คำอธิบายระดับ",
|
||||
default: null,
|
||||
})
|
||||
description: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
comment: "ระดับ",
|
||||
default: null,
|
||||
})
|
||||
level: Number;
|
||||
level: string;
|
||||
|
||||
@Column({
|
||||
nullable: true,
|
||||
|
|
@ -26,7 +30,6 @@ export class KpiCapacityDetail extends EntityBase {
|
|||
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.KpiCapacityDetails)
|
||||
@JoinColumn({ name: "kpiCapacityId" })
|
||||
kpiCapacitys: KpiCapacity;
|
||||
|
||||
}
|
||||
export class createKpiCapacityDetail {
|
||||
@Column()
|
||||
|
|
|
|||
|
|
@ -4,8 +4,10 @@ import { EntityBase } from "./base/Base";
|
|||
@Entity("kpiEvaluation")
|
||||
export class KpiEvaluation extends EntityBase {
|
||||
@Column({
|
||||
nullable: true,
|
||||
type: "longtext",
|
||||
comment: "เกณฑ์การประเมิน",
|
||||
default: null,
|
||||
})
|
||||
description: string;
|
||||
|
||||
|
|
@ -26,7 +28,7 @@ export class createKpiEvaluation {
|
|||
export class updateKpiEvaluation {
|
||||
@Column()
|
||||
description: string;
|
||||
|
||||
|
||||
@Column()
|
||||
level: Number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ export class KpiPeriod extends EntityBase {
|
|||
|
||||
@Column({
|
||||
comment: "รอบ",
|
||||
default: false,
|
||||
default: true,
|
||||
})
|
||||
isActive: boolean;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class UpdateTableKpievaDescriptionNullable1713435800020 implements MigrationInterface {
|
||||
name = 'UpdateTableKpievaDescriptionNullable1713435800020'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiPeriod\` CHANGE \`isActive\` \`isActive\` tinyint NOT NULL COMMENT 'รอบ' DEFAULT 1`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiEvaluation\` CHANGE \`description\` \`description\` longtext NULL COMMENT 'เกณฑ์การประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacity\` CHANGE \`description\` \`description\` longtext NULL COMMENT 'คำจำกัดความ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacityDetail\` CHANGE \`description\` \`description\` longtext NULL COMMENT 'คำอธิบายระดับ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacityDetail\` DROP COLUMN \`level\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacityDetail\` ADD \`level\` varchar(255) NULL COMMENT 'ระดับ'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacityDetail\` DROP COLUMN \`level\``);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacityDetail\` ADD \`level\` int NOT NULL COMMENT 'ระดับ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacityDetail\` CHANGE \`description\` \`description\` longtext NOT NULL COMMENT 'คำอธิบายระดับ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiCapacity\` CHANGE \`description\` \`description\` longtext NOT NULL COMMENT 'คำจำกัดความ'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiEvaluation\` CHANGE \`description\` \`description\` longtext NOT NULL COMMENT 'เกณฑ์การประเมิน'`);
|
||||
await queryRunner.query(`ALTER TABLE \`kpiPeriod\` CHANGE \`isActive\` \`isActive\` tinyint NOT NULL COMMENT 'รอบ' DEFAULT '0'`);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue