แก้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 { EntityBase } from "./base/Base";
|
||||||
import { KpiCapacityDetail } from "./kpiCapacityDetail";
|
import { KpiCapacityDetail } from "./kpiCapacityDetail";
|
||||||
|
|
||||||
|
|
@ -15,7 +15,7 @@ export class KpiCapacity extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment:
|
comment:
|
||||||
"ประเภทสมรรถนะดังนี้ HEAD = สมรรถนะหลัก, GROUP = สมรรถนะประจำกลุ่ม, EXECUTIVE = สมรรถนะประจำผู้บริหารกรุงเทพมหานคร, "+
|
"ประเภทสมรรถนะดังนี้ HEAD = สมรรถนะหลัก, GROUP = สมรรถนะประจำกลุ่ม, EXECUTIVE = สมรรถนะประจำผู้บริหารกรุงเทพมหานคร, " +
|
||||||
"DIRECTOR = สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ., INSPECTOR = สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ",
|
"DIRECTOR = สมรรถนะเฉพาะสำหรับตำแหน่ง ผอ., INSPECTOR = สมรรถนะเฉพาะสำหรับตำแหน่งผู้ตรวจราชการ",
|
||||||
type: "enum",
|
type: "enum",
|
||||||
enum: CapacityType,
|
enum: CapacityType,
|
||||||
|
|
@ -31,14 +31,15 @@ export class KpiCapacity extends EntityBase {
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
nullable: true,
|
||||||
type: "longtext",
|
type: "longtext",
|
||||||
comment: "คำจำกัดความ",
|
comment: "คำจำกัดความ",
|
||||||
|
default: null,
|
||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacitys)
|
@OneToMany(() => KpiCapacityDetail, (kpiCapacityDetail) => kpiCapacityDetail.kpiCapacitys)
|
||||||
KpiCapacityDetails: KpiCapacityDetail[];
|
KpiCapacityDetails: KpiCapacityDetail[];
|
||||||
|
|
||||||
}
|
}
|
||||||
export class createKpiCapacity {
|
export class createKpiCapacity {
|
||||||
@Column()
|
@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 { EntityBase } from "./base/Base";
|
||||||
import { KpiCapacity } from "./kpiCapacity";
|
import { KpiCapacity } from "./kpiCapacity";
|
||||||
|
|
||||||
@Entity("kpiCapacityDetail")
|
@Entity("kpiCapacityDetail")
|
||||||
export class KpiCapacityDetail extends EntityBase {
|
export class KpiCapacityDetail extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
|
nullable: true,
|
||||||
type: "longtext",
|
type: "longtext",
|
||||||
comment: "คำอธิบายระดับ",
|
comment: "คำอธิบายระดับ",
|
||||||
|
default: null,
|
||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
|
nullable: true,
|
||||||
comment: "ระดับ",
|
comment: "ระดับ",
|
||||||
|
default: null,
|
||||||
})
|
})
|
||||||
level: Number;
|
level: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
|
|
@ -26,7 +30,6 @@ export class KpiCapacityDetail extends EntityBase {
|
||||||
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.KpiCapacityDetails)
|
@ManyToOne(() => KpiCapacity, (kpiCapacity) => kpiCapacity.KpiCapacityDetails)
|
||||||
@JoinColumn({ name: "kpiCapacityId" })
|
@JoinColumn({ name: "kpiCapacityId" })
|
||||||
kpiCapacitys: KpiCapacity;
|
kpiCapacitys: KpiCapacity;
|
||||||
|
|
||||||
}
|
}
|
||||||
export class createKpiCapacityDetail {
|
export class createKpiCapacityDetail {
|
||||||
@Column()
|
@Column()
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ import { EntityBase } from "./base/Base";
|
||||||
@Entity("kpiEvaluation")
|
@Entity("kpiEvaluation")
|
||||||
export class KpiEvaluation extends EntityBase {
|
export class KpiEvaluation extends EntityBase {
|
||||||
@Column({
|
@Column({
|
||||||
|
nullable: true,
|
||||||
type: "longtext",
|
type: "longtext",
|
||||||
comment: "เกณฑ์การประเมิน",
|
comment: "เกณฑ์การประเมิน",
|
||||||
|
default: null,
|
||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export class KpiPeriod extends EntityBase {
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
comment: "รอบ",
|
comment: "รอบ",
|
||||||
default: false,
|
default: true,
|
||||||
})
|
})
|
||||||
isActive: boolean;
|
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