ปรับโครงาร

This commit is contained in:
Kittapath 2024-04-11 11:39:56 +07:00
parent b8e1c93cb4
commit 4f8b2cec73
10 changed files with 1317 additions and 483 deletions

File diff suppressed because it is too large Load diff

View file

@ -313,6 +313,7 @@ export class DevelopmentScholarshipController extends Controller {
: null,
totalPeriod: getDevelopment.totalPeriod ? getDevelopment.totalPeriod : null,
status: getDevelopment.status ? getDevelopment.status : null,
profileId: getDevelopment.profileId ? getDevelopment.profileId : null,
};
return new HttpSuccess(formattedData);
}

View file

@ -6,9 +6,22 @@ import { CreatePlannedPeople, PlannedPeople } from "./PlannedPeople";
import { ActualGoal, CreateActualGoal } from "./ActualGoal";
import { CreatePlannedGoal, PlannedGoal } from "./PlannedGoal";
import { DevelopmentHistory } from "./DevelopmentHistory";
import { DevelopmentProjectType } from "./DevelopmentProjectType";
import { DevelopmentProjectTechnique } from "./DevelopmentProjectTechnique";
import { CreateDevelopmentEvaluation, DevelopmentEvaluation } from "./DevelopmentEvaluation";
import { CreateDevelopmentAddress, DevelopmentAddress } from "./DevelopmentAddress";
@Entity("development")
export class Development extends EntityBase {
@Column({
// กำลังดำเนินการ (ONGOING)
// เสร็จสิ้น (FINISH)
nullable: true,
comment: "สถานะ",
default: "ONGOING",
})
status: string;
////////////////////////////////////////tab ข้อมูลเบื้องต้น
@Column({
nullable: true,
comment: "ปีงบประมาณ",
@ -35,61 +48,118 @@ export class Development extends EntityBase {
})
objective: string;
////////////////////////////////////////tab เป้าหมาย
@OneToMany(
() => ActualPeople,
(actualPeople: ActualPeople) => actualPeople.developmentActualPeople,
)
developmentActualPeoples: ActualPeople[];
@OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.developmentActualGoal)
developmentActualGoals: ActualGoal[];
@OneToMany(
() => PlannedPeople,
(plannedPeople: PlannedPeople) => plannedPeople.developmentPlannedPeople,
)
developmentPlannedPeoples: PlannedPeople[];
@OneToMany(() => PlannedGoal, (plannedGoal: PlannedGoal) => plannedGoal.developmentPlannedGoal)
developmentPlannedGoals: PlannedGoal[];
////////////////////////////////////////tab ลักษณะโครงการ
@OneToMany(
() => DevelopmentProjectType,
(developmentProjectType: DevelopmentProjectType) => developmentProjectType.development,
)
developmentProjectTypes: DevelopmentProjectType[];
@Column({
nullable: true,
comment: "ประเภทตัวชี้วัด",
default: null,
comment: "ไป-กลับ",
default: false,
})
metricType: string;
isBackPlanned: boolean;
@Column({
comment: "พักค้าง",
default: false,
})
isHoldPlanned: boolean;
@Column({
nullable: true,
comment: "ตัวชี้วัด",
comment: "จำนวน(วัน)(ไป-กลับ)",
default: null,
})
indicators: string;
projectDayBackPlanned: number;
@Column({
nullable: true,
comment: "เป้าหมาย",
comment: "จำนวน(วัน)(พักค้าง)",
default: null,
})
target: string;
projectDayHoldPlanned: number;
@Column({
nullable: true,
comment: "วิธีการคำนวณ/เครื่องมือ",
comment: "จำนวน(คืน)(พักค้าง)",
default: null,
})
calculation: string;
projectNigthHoldPlanned: number;
@Column({
comment: "ไป-กลับ",
default: false,
})
isBackActual: boolean;
@Column({
comment: "พักค้าง",
default: false,
})
isHoldActual: boolean;
@Column({
nullable: true,
comment: "ระยะเวลาวัดผล",
comment: "จำนวน(วัน)(ไป-กลับ)",
default: null,
})
measuRement: string;
projectDayBackActual: number;
@Column({
nullable: true,
comment: "ผลการดำเนิน",
comment: "จำนวน(วัน)(พักค้าง)",
default: null,
})
results: string;
projectDayHoldActual: number;
@Column({
nullable: true,
comment: "ปัญหาอุปสรรค",
comment: "จำนวน(คืน)(พักค้าง)",
default: null,
})
obstacles: string;
projectNigthHoldActual: number;
@OneToMany(
() => DevelopmentProjectTechnique,
(developmentProjectTechnique: DevelopmentProjectTechnique) =>
developmentProjectTechnique.development,
)
developmentProjectTechniques: DevelopmentProjectTechnique[];
@Column({
nullable: true,
comment: "ข้อเสนอเเนะ",
comment: "จำนวน(รุ่น)",
default: null,
})
suggestions: string;
projectModal: number;
////////////////////////////////////////tab ผลประเมิน
@OneToMany(
() => DevelopmentEvaluation,
(developmentEvaluation: DevelopmentEvaluation) => developmentEvaluation.development,
)
developmentEvaluations: DevelopmentEvaluation[];
@Column({
nullable: true,
@ -129,6 +199,7 @@ export class Development extends EntityBase {
})
isOutBudget: boolean;
////////////////////////////////////////tab อื่นๆ
@Column({
nullable: true,
type: "datetime",
@ -152,12 +223,11 @@ export class Development extends EntityBase {
})
totalDate: number;
@Column({
nullable: true,
comment: "ที่อยู่",
default: null,
})
address: string;
@OneToMany(
() => DevelopmentAddress,
(developmentAddress: DevelopmentAddress) => developmentAddress.development,
)
developmentAddresss: DevelopmentAddress[];
@Column({
nullable: true,
@ -166,6 +236,16 @@ export class Development extends EntityBase {
})
budget: string;
@Column({
// เงินบำรุง = MAINTENANCE
// เงินกองทุน = FUND
// เงินอุดหนุน = SUBSIDY
nullable: true,
comment: "ประเภทย่อย",
default: null,
})
budgetSub: string;
@Column({
nullable: true,
comment: "จํานวนงบประมาณที่ขอรับการจัดสรรฯ",
@ -210,14 +290,14 @@ export class Development extends EntityBase {
comment: "โอกาสที่จะเกิด",
default: null,
})
chance: string;
chance: number;
@Column({
nullable: true,
comment: "ผลกระทบจากการเกิด",
default: null,
})
effects: string;
effects: number;
@Column({
nullable: true,
@ -254,6 +334,17 @@ export class Development extends EntityBase {
})
addressAcademic: string;
@Column({
nullable: true,
comment: "จังหวัด(ข้อมูลวิชาการ)",
default: null,
})
provinceActualId: string;
@ManyToOne(() => Province, (province: Province) => province.developmentActuals)
@JoinColumn({ name: "provinceActualId" })
provinceActual: Province;
@Column({
nullable: true,
type: "datetime",
@ -270,105 +361,6 @@ export class Development extends EntityBase {
})
dateStudyEnd: Date;
@Column({
// STRATEGIC_PROJECT = โครงการตามยุทธศาสตร์
// MISSION_PROJECT = โครงการตามภารกิจประจำของหน่วยงาน
// NEW_PROJECT = โครงการใหม่
// ONGOING_PROJECT = โครงการต่อเนื่อง
nullable: true,
comment: "ประเภทโครงการ",
default: null,
})
projectType: string;
@Column({
// GO_BACK = ไป-กลับ
// HOLD = พักค้าง
// GO_BACK_HOLD = ไป-กลับและพักค้าง
nullable: true,
comment: "ลักษณะ",
default: null,
})
projectCharacteristics: string;
@Column({
nullable: true,
comment: "จำนวน(วัน)",
default: null,
})
projectDay: number;
@Column({
nullable: true,
comment: "จำนวน(คืน)",
default: null,
})
projectNigth: number;
@Column({
// TRAINING = การอบรม
// MEETING = การประชุม
// SEMINAR = การสัมมนา
// STUDY_TOUR = การศึกษาดูงาน
// ACADEMIC_SEMINAR = การสัมมนาทางวิชาการ
// WORKSHOP = การสัมมนาเชิงปฏิบัติการ
// SPECIAL_LECTURE = การบรรยายพิเศษ
// STUDY_TRAINING = การฝึกศึกษา
nullable: true,
comment: "เทคนิควิธีการที่ใช้ในการพัฒนา",
default: null,
})
projectTechniques: string;
@Column({
nullable: true,
comment: "จำนวน(รุ่น)",
default: null,
})
projectModal: number;
@Column({
// เงินบำรุง = MAINTENANCE
// เงินกองทุน = FUND
// เงินอุดหนุน = SUBSIDY
nullable: true,
comment: "ประเภทย่อย",
default: null,
})
budgetSub: string;
@Column({
nullable: true,
comment: "จังหวัด(ข้อมูลวิชาการ)",
default: null,
})
provinceActualId: string;
@ManyToOne(() => Province, (province: Province) => province.developmentActuals)
@JoinColumn({ name: "provinceActualId" })
provinceActual: Province;
@ManyToMany(() => Province, (provinces) => provinces.developmentProvinces)
provinces: Province[];
@OneToMany(
() => ActualPeople,
(actualPeople: ActualPeople) => actualPeople.developmentActualPeople,
)
developmentActualPeoples: ActualPeople[];
@OneToMany(
() => PlannedPeople,
(plannedPeople: PlannedPeople) => plannedPeople.developmentPlannedPeople,
)
developmentPlannedPeoples: PlannedPeople[];
@OneToMany(() => ActualGoal, (actualGoal: ActualGoal) => actualGoal.developmentActualGoal)
developmentActualGoals: ActualGoal[];
@OneToMany(() => PlannedGoal, (plannedGoal: PlannedGoal) => plannedGoal.developmentPlannedGoal)
developmentPlannedGoals: PlannedGoal[];
@OneToMany(
() => DevelopmentHistory,
(developmentHistory: DevelopmentHistory) => developmentHistory.development,
@ -380,105 +372,9 @@ export class CreateDevelopment {
year: number;
@Column()
projectName: string;
@Column()
reason: string | null;
@Column()
objective: string | null;
@Column()
metricType: string | null;
@Column()
indicators: string | null;
@Column()
target: string | null;
@Column()
calculation: string | null;
@Column()
measuRement: string | null;
@Column()
results: string | null;
@Column()
obstacles: string | null;
@Column()
suggestions: string | null;
@Column()
project: string | null;
@Column()
isPassAllocate: boolean;
@Column()
isPassNoAllocate: boolean;
@Column()
isNoPass: boolean;
@Column()
isBudget: boolean;
@Column()
isOutBudget: boolean;
@Column()
dateStart: Date | null;
@Column()
dateEnd: Date | null;
@Column()
totalDate: number | null;
@Column()
address: string | null;
@Column()
provinceIds: string[];
@Column()
budget: string | null;
@Column()
accept: Double | null;
@Column()
receive: Double | null;
@Column()
approved: Double | null;
@Column()
budgetPay: Double | null;
@Column()
issues: string | null;
@Column()
chance: string | null;
@Column()
effects: string | null;
@Column()
riskLevel: string | null;
@Column()
riskManagement: string | null;
@Column()
expect: string | null;
@Column()
topicAcademic: string | null;
@Column()
addressAcademic: string | null;
@Column()
provinceActualId: string | null;
@Column()
dateStudyStart?: Date | null;
@Column()
dateStudyEnd?: Date | null;
@Column()
projectType: string | null;
@Column()
projectCharacteristics: string | null;
@Column()
projectDay: number | null;
@Column()
projectNigth: number | null;
@Column()
projectTechniques: string | null;
@Column()
projectModal: number | null;
@Column()
budgetSub: string | null;
@Column()
actualPeoples: CreateActualPeople[];
@Column()
plannedPeoples: CreatePlannedPeople[];
@Column()
actualGoals: CreateActualGoal[];
@Column()
plannedGoals: CreatePlannedGoal[];
}
export class UpdateDevelopment {
export class UpdateDevelopment1 {
@Column()
year: number;
@Column()
@ -487,22 +383,50 @@ export class UpdateDevelopment {
reason: string | null;
@Column()
objective: string | null;
}
export class UpdateDevelopment2_1 {
@Column()
metricType: string | null;
actualGoals: CreateActualGoal[];
@Column()
indicators: string | null;
plannedGoals: CreatePlannedGoal[];
}
export class UpdateDevelopment2_2 {
@Column()
target: string | null;
actualPeoples: CreateActualPeople[];
@Column()
calculation: string | null;
plannedPeoples: CreatePlannedPeople[];
}
export class UpdateDevelopment3 {
@Column()
measuRement: string | null;
developmentProjectTypes?: string[];
@Column()
results: string | null;
isBackPlanned?: boolean | null;
@Column()
obstacles: string | null;
isHoldPlanned?: boolean | null;
@Column()
suggestions: string | null;
projectDayBackPlanned?: number | null;
@Column()
projectDayHoldPlanned?: number | null;
@Column()
projectNigthHoldPlanned?: number | null;
@Column()
isBackActual?: boolean | null;
@Column()
isHoldActual?: boolean | null;
@Column()
projectDayBackActual?: number | null;
@Column()
projectDayHoldActual?: number | null;
@Column()
projectNigthHoldActual?: number | null;
@Column()
developmentProjectTechniques?: string[];
@Column()
projectModal?: number | null;
}
export class UpdateDevelopment4 {
@Column()
developmentEvaluations: CreateDevelopmentEvaluation[];
@Column()
project: string | null;
@Column()
@ -515,6 +439,8 @@ export class UpdateDevelopment {
isBudget: boolean;
@Column()
isOutBudget: boolean;
}
export class UpdateDevelopment5 {
@Column()
dateStart: Date | null;
@Column()
@ -522,12 +448,12 @@ export class UpdateDevelopment {
@Column()
totalDate: number | null;
@Column()
address: string | null;
@Column()
provinceIds: string[];
developmentAddresss: CreateDevelopmentAddress[];
@Column()
budget: string | null;
@Column()
budgetSub: string | null;
@Column()
accept: Double | null;
@Column()
receive: Double | null;
@ -538,9 +464,9 @@ export class UpdateDevelopment {
@Column()
issues: string | null;
@Column()
chance: string | null;
chance: number | null;
@Column()
effects: string | null;
effects: number | null;
@Column()
riskLevel: string | null;
@Column()
@ -554,29 +480,7 @@ export class UpdateDevelopment {
@Column()
provinceActualId: string | null;
@Column()
dateStudyStart?: Date | null;
dateStudyStart: Date | null;
@Column()
dateStudyEnd?: Date | null;
@Column()
projectType?: string | null;
@Column()
projectCharacteristics?: string | null;
@Column()
projectDay?: number | null;
@Column()
projectNigth?: number | null;
@Column()
projectTechniques?: string | null;
@Column()
projectModal?: number | null;
@Column()
budgetSub: string | null;
@Column()
actualPeoples: CreateActualPeople[];
@Column()
plannedPeoples: CreatePlannedPeople[];
@Column()
actualGoals: CreateActualGoal[];
@Column()
plannedGoals: CreatePlannedGoal[];
dateStudyEnd: Date | null;
}

View file

@ -0,0 +1,42 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
import { Province } from "./Province";
@Entity("developmentAddress")
export class DevelopmentAddress extends EntityBase {
@Column({
nullable: true,
comment: "ที่อยู่",
default: null,
})
address: string;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
provinceId: string;
@ManyToOne(() => Province, (province: Province) => province.developmentAddresss)
@JoinColumn({ name: "provinceId" })
province: Province;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentId: string;
@ManyToOne(() => Development, (development: Development) => development.developmentAddresss)
@JoinColumn({ name: "developmentId" })
development: Development;
}
export class CreateDevelopmentAddress {
@Column()
address: string | null;
@Column()
provinceId: string;
}

View file

@ -0,0 +1,90 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
@Entity("developmentEvaluation")
export class DevelopmentEvaluation extends EntityBase {
@Column({
nullable: true,
comment: "ตัวชี้วัด",
default: null,
})
indicators: string;
@Column({
nullable: true,
comment: "เป้าหมาย",
default: null,
})
target: number;
@Column({
nullable: true,
comment: "ประเภทตัวชี้วัด",
default: null,
})
metricType: string;
@Column({
nullable: true,
comment: "วิธีการคำนวณ/เครื่องมือ",
default: null,
})
calculation: string;
@Column({
nullable: true,
comment: "ระยะเวลาวัดผล",
default: null,
})
measuRement: string;
@Column({
nullable: true,
comment: "ผลการดำเนิน",
default: null,
})
results: string;
@Column({
nullable: true,
comment: "ปัญหาอุปสรรค",
default: null,
})
obstacles: string;
@Column({
nullable: true,
comment: "ข้อเสนอเเนะ",
default: null,
})
suggestions: string;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentId: string;
@ManyToOne(() => Development, (development: Development) => development.developmentEvaluations)
@JoinColumn({ name: "developmentId" })
development: Development;
}
export class CreateDevelopmentEvaluation {
@Column()
indicators: string | null;
@Column()
target: number | null;
@Column()
metricType: string | null;
@Column()
calculation: string | null;
@Column()
measuRement: string | null;
@Column()
results: string | null;
@Column()
obstacles: string | null;
@Column()
suggestions: string | null;
}

View file

@ -0,0 +1,39 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
@Entity("developmentProjectTechnique")
export class DevelopmentProjectTechnique extends EntityBase {
@Column({
// TRAINING = การอบรม
// MEETING = การประชุม
// SEMINAR = การสัมมนา
// STUDY_TOUR = การศึกษาดูงาน
// ACADEMIC_SEMINAR = การสัมมนาทางวิชาการ
// WORKSHOP = การสัมมนาเชิงปฏิบัติการ
// SPECIAL_LECTURE = การบรรยายพิเศษ
// STUDY_TRAINING = การฝึกศึกษา
nullable: true,
comment: "เทคนิควิธีการที่ใช้ในการพัฒนา",
default: null,
})
name: string;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentId: string;
@ManyToOne(
() => Development,
(development: Development) => development.developmentProjectTechniques,
)
@JoinColumn({ name: "developmentId" })
development: Development;
}
export class CreateDevelopmentProjectTechnique {
@Column()
name: number;
}

View file

@ -0,0 +1,32 @@
import { Entity, Column, ManyToOne, JoinColumn } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
@Entity("developmentProjectType")
export class DevelopmentProjectType extends EntityBase {
@Column({
// STRATEGIC_PROJECT = โครงการตามยุทธศาสตร์
// MISSION_PROJECT = โครงการตามภารกิจประจำของหน่วยงาน
// NEW_PROJECT = โครงการใหม่
// ONGOING_PROJECT = โครงการต่อเนื่อง
nullable: true,
comment: "ประเภทโครงการ",
default: null,
})
name: string;
@Column({
nullable: true,
comment: "โครงการ/หลักสูตรการฝึกอบรม",
default: null,
})
developmentId: string;
@ManyToOne(() => Development, (development: Development) => development.developmentProjectTypes)
@JoinColumn({ name: "developmentId" })
development: Development;
}
export class CreateDevelopmentProjectType {
@Column()
name: string;
}

View file

@ -1,6 +1,7 @@
import { Entity, Column, OneToMany, ManyToMany, JoinTable } from "typeorm";
import { EntityBase } from "./base/Base";
import { Development } from "./Development";
import { DevelopmentAddress } from "./DevelopmentAddress";
@Entity("province")
export class Province extends EntityBase {
@ -12,9 +13,11 @@ export class Province extends EntityBase {
})
name: string;
@ManyToMany(() => Development, (development) => development.provinces)
@JoinTable()
developmentProvinces: Development[];
@OneToMany(
() => DevelopmentAddress,
(developmentAddress: DevelopmentAddress) => developmentAddress.province,
)
developmentAddresss: DevelopmentAddress[];
@OneToMany(() => Development, (development: Development) => development.provinceActual)
developmentActuals: Development[];

View file

@ -0,0 +1,92 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableDevRefresh11712778363784 implements MigrationInterface {
name = 'UpdateTableDevRefresh11712778363784'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`developmentAddress\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`address\` varchar(255) NULL COMMENT 'ที่อยู่', \`provinceId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', \`developmentId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`developmentProjectType\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`name\` varchar(255) NULL COMMENT 'ประเภทโครงการ', \`developmentId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`developmentProjectTechnique\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`name\` varchar(255) NULL COMMENT 'เทคนิควิธีการที่ใช้ในการพัฒนา', \`developmentId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`CREATE TABLE \`developmentEvaluation\` (\`id\` varchar(36) NOT NULL, \`createdAt\` datetime(6) NOT NULL COMMENT 'สร้างข้อมูลเมื่อ' DEFAULT CURRENT_TIMESTAMP(6), \`createdUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่สร้างข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`lastUpdatedAt\` datetime(6) NOT NULL COMMENT 'แก้ไขข้อมูลล่าสุดเมื่อ' DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6), \`lastUpdateUserId\` varchar(40) NOT NULL COMMENT 'User Id ที่แก้ไขข้อมูล' DEFAULT '00000000-0000-0000-0000-000000000000', \`createdFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่สร้างข้อมูล' DEFAULT 'string', \`lastUpdateFullName\` varchar(200) NOT NULL COMMENT 'ชื่อ User ที่แก้ไขข้อมูลล่าสุด' DEFAULT 'string', \`indicators\` varchar(255) NULL COMMENT 'ตัวชี้วัด', \`target\` int NULL COMMENT 'เป้าหมาย', \`metricType\` varchar(255) NULL COMMENT 'ประเภทตัวชี้วัด', \`calculation\` varchar(255) NULL COMMENT 'วิธีการคำนวณ/เครื่องมือ', \`measuRement\` varchar(255) NULL COMMENT 'ระยะเวลาวัดผล', \`results\` varchar(255) NULL COMMENT 'ผลการดำเนิน', \`obstacles\` varchar(255) NULL COMMENT 'ปัญหาอุปสรรค', \`suggestions\` varchar(255) NULL COMMENT 'ข้อเสนอเเนะ', \`developmentId\` varchar(255) NULL COMMENT 'โครงการ/หลักสูตรการฝึกอบรม', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`metricType\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`indicators\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`target\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`calculation\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`measuRement\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`results\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`obstacles\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`suggestions\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`address\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`dateStudyStart\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`dateStudyEnd\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectType\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectCharacteristics\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDay\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigth\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectTechniques\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`status\` varchar(255) NULL COMMENT 'สถานะ' DEFAULT 'ONGOING'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`isBackPlanned\` tinyint NOT NULL COMMENT 'ไป-กลับ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`isHoldPlanned\` tinyint NOT NULL COMMENT 'พักค้าง' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackPlanned\` int NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldPlanned\` int NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldPlanned\` int NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`isBackActual\` tinyint NOT NULL COMMENT 'ไป-กลับ' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`isHoldActual\` tinyint NOT NULL COMMENT 'พักค้าง' DEFAULT 0`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayBackActual\` int NULL COMMENT 'จำนวน(วัน)(ไป-กลับ)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDayHoldActual\` int NULL COMMENT 'จำนวน(วัน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigthHoldActual\` int NULL COMMENT 'จำนวน(คืน)(พักค้าง)'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`chance\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`chance\` int NULL COMMENT 'โอกาสที่จะเกิด'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`effects\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`effects\` int NULL COMMENT 'ผลกระทบจากการเกิด'`);
await queryRunner.query(`ALTER TABLE \`developmentAddress\` ADD CONSTRAINT \`FK_e2721b3f440256b56ce83a04fb2\` FOREIGN KEY (\`provinceId\`) REFERENCES \`province\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentAddress\` ADD CONSTRAINT \`FK_de5eb0e55892aa0cf019afb284d\` FOREIGN KEY (\`developmentId\`) REFERENCES \`development\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProjectType\` ADD CONSTRAINT \`FK_e9c5a726024b87bb10f23570a98\` FOREIGN KEY (\`developmentId\`) REFERENCES \`development\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentProjectTechnique\` ADD CONSTRAINT \`FK_902408e69fa1cf0ed815859e089\` FOREIGN KEY (\`developmentId\`) REFERENCES \`development\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` ADD CONSTRAINT \`FK_1714596cf3e3e8311a766800289\` FOREIGN KEY (\`developmentId\`) REFERENCES \`development\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`developmentEvaluation\` DROP FOREIGN KEY \`FK_1714596cf3e3e8311a766800289\``);
await queryRunner.query(`ALTER TABLE \`developmentProjectTechnique\` DROP FOREIGN KEY \`FK_902408e69fa1cf0ed815859e089\``);
await queryRunner.query(`ALTER TABLE \`developmentProjectType\` DROP FOREIGN KEY \`FK_e9c5a726024b87bb10f23570a98\``);
await queryRunner.query(`ALTER TABLE \`developmentAddress\` DROP FOREIGN KEY \`FK_de5eb0e55892aa0cf019afb284d\``);
await queryRunner.query(`ALTER TABLE \`developmentAddress\` DROP FOREIGN KEY \`FK_e2721b3f440256b56ce83a04fb2\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`effects\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`effects\` varchar(255) NULL COMMENT 'ผลกระทบจากการเกิด'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`chance\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`chance\` varchar(255) NULL COMMENT 'โอกาสที่จะเกิด'`);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackActual\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isHoldActual\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isBackActual\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectNigthHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`projectDayBackPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isHoldPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`isBackPlanned\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`status\``);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectTechniques\` varchar(255) NULL COMMENT 'เทคนิควิธีการที่ใช้ในการพัฒนา'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectNigth\` int NULL COMMENT 'จำนวน(คืน)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectDay\` int NULL COMMENT 'จำนวน(วัน)'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectCharacteristics\` varchar(255) NULL COMMENT 'ลักษณะ'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`projectType\` varchar(255) NULL COMMENT 'ประเภทโครงการ'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`dateStudyEnd\` datetime NULL COMMENT 'วันสิ้นสุดการศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`dateStudyStart\` datetime NULL COMMENT 'วันเริ่มต้นการศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`address\` varchar(255) NULL COMMENT 'ที่อยู่'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`suggestions\` varchar(255) NULL COMMENT 'ข้อเสนอเเนะ'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`obstacles\` varchar(255) NULL COMMENT 'ปัญหาอุปสรรค'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`results\` varchar(255) NULL COMMENT 'ผลการดำเนิน'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`measuRement\` varchar(255) NULL COMMENT 'ระยะเวลาวัดผล'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`calculation\` varchar(255) NULL COMMENT 'วิธีการคำนวณ/เครื่องมือ'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`target\` varchar(255) NULL COMMENT 'เป้าหมาย'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`indicators\` varchar(255) NULL COMMENT 'ตัวชี้วัด'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`metricType\` varchar(255) NULL COMMENT 'ประเภทตัวชี้วัด'`);
await queryRunner.query(`DROP TABLE \`developmentEvaluation\``);
await queryRunner.query(`DROP TABLE \`developmentProjectTechnique\``);
await queryRunner.query(`DROP TABLE \`developmentProjectType\``);
await queryRunner.query(`DROP TABLE \`developmentAddress\``);
}
}

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableDevRefresh21712779710145 implements MigrationInterface {
name = 'UpdateTableDevRefresh21712779710145'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`development\` ADD \`dateStudyStart\` datetime NULL COMMENT 'วันเริ่มต้นการศึกษาดูงาน'`);
await queryRunner.query(`ALTER TABLE \`development\` ADD \`dateStudyEnd\` datetime NULL COMMENT 'วันสิ้นสุดการศึกษาดูงาน'`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`dateStudyEnd\``);
await queryRunner.query(`ALTER TABLE \`development\` DROP COLUMN \`dateStudyStart\``);
}
}