api userEvaluation

This commit is contained in:
Bright 2024-04-22 13:23:31 +07:00
parent 22117c4d24
commit 1c7d62e149
3 changed files with 228 additions and 0 deletions

View file

@ -0,0 +1,16 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableKpiUserEvaluation1713757864608 implements MigrationInterface {
name = 'AddTableKpiUserEvaluation1713757864608'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`kpiUserEvaluation\` (\`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', \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า', \`firstName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'สกุล', \`kpiPeriodId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง kpiPeriodId', \`profileId\` varchar(40) NULL COMMENT 'ไอดีโปรไฟล์', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` ADD CONSTRAINT \`FK_ec9dcf722db1e7d96b21b6b85aa\` FOREIGN KEY (\`kpiPeriodId\`) REFERENCES \`kpiPeriod\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluation\` DROP FOREIGN KEY \`FK_ec9dcf722db1e7d96b21b6b85aa\``);
await queryRunner.query(`DROP TABLE \`kpiUserEvaluation\``);
}
}