migrate
This commit is contained in:
parent
41872546ae
commit
5ca457e856
3 changed files with 46 additions and 0 deletions
22
src/entities/AnnounceTemplate.ts
Normal file
22
src/entities/AnnounceTemplate.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import { Entity, Column, ManyToOne, JoinColumn, OneToOne } from "typeorm";
|
||||
import { EntityBase } from "./base/Base";
|
||||
import { Evaluation } from "./Evaluation";
|
||||
|
||||
@Entity("announcetemplate")
|
||||
export class AnnounceTemplate extends EntityBase {
|
||||
|
||||
@Column({ nullable: true, comment: "code สำหรับเรียก template" }) //ตัวอย่าง ST05-1 (ใช้ที่ STEP 5 ลำดับที่ 1)
|
||||
code: string;
|
||||
|
||||
@Column({ nullable: true, comment: "ชื่อประกาศ" })
|
||||
name: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true, comment: 'รายละเอียด'})
|
||||
detailBody: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true, comment: 'รายละเอียดส่วนท้าย'})
|
||||
detailFooter: string;
|
||||
|
||||
}
|
||||
|
||||
export type UpdateAnnounceTemplate = Partial<AnnounceTemplate>;
|
||||
|
|
@ -266,6 +266,12 @@ export class Evaluation extends EntityBase {
|
|||
@Column({ nullable: true, comment: "ผลการประเมิน", default: "PENDING" }) //PENDING,PASS,NOTPASS
|
||||
evaluationResult: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true, comment: 'รายละเอียดประกาศ(STEP5)'})
|
||||
detailAnnounceStep5Body: string;
|
||||
|
||||
@Column({ type: 'text', nullable: true, comment: 'รายละเอียดส่วนท้าย(STEP5)'})
|
||||
detailAnnounceStep5Footer: string;
|
||||
|
||||
@OneToMany(() => EvaluationLogs, (evaluationLogs) => evaluationLogs.evaluation)
|
||||
evaluationLogs: EvaluationLogs[];
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class CreateTableAnnounceTemplateAndUpdateFieldEvaluation1745292839344 implements MigrationInterface {
|
||||
name = 'CreateTableAnnounceTemplateAndUpdateFieldEvaluation1745292839344'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE TABLE \`announcetemplate\` (\`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', \`code\` varchar(255) NULL COMMENT 'code สำหรับเรียก template', \`name\` varchar(255) NULL COMMENT 'ชื่อประกาศ', \`detailBody\` text NULL COMMENT 'รายละเอียด', \`detailFooter\` text NULL COMMENT 'รายละเอียดส่วนท้าย', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`detailAnnounceStep5Body\` text NULL COMMENT 'รายละเอียดประกาศ(STEP5)'`);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` ADD \`detailAnnounceStep5Footer\` text NULL COMMENT 'รายละเอียดส่วนท้าย(STEP5)'`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`detailAnnounceStep5Footer\``);
|
||||
await queryRunner.query(`ALTER TABLE \`evaluation\` DROP COLUMN \`detailAnnounceStep5Body\``);
|
||||
await queryRunner.query(`DROP TABLE \`announcetemplate\``);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue