no message

This commit is contained in:
Kittapath 2024-04-22 16:30:24 +07:00
parent 65e1d682b1
commit 42264be4a2
16 changed files with 55 additions and 201 deletions

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class AddTableKpiUserSpecial11713778172793 implements MigrationInterface {
name = 'AddTableKpiUserSpecial11713778172793'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`kpiUserCapacity\` (\`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', \`kpiUserEvaluationId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง kpiUserEvaluation', \`kpiCapacityId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง kpiCapacity', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` ADD CONSTRAINT \`FK_1aef260bab99de5f8278082da55\` FOREIGN KEY (\`kpiUserEvaluationId\`) REFERENCES \`kpiUserEvaluation\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` ADD CONSTRAINT \`FK_d0bfc0e85bc171bcc631c621266\` FOREIGN KEY (\`kpiCapacityId\`) REFERENCES \`kpiCapacity\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` DROP FOREIGN KEY \`FK_d0bfc0e85bc171bcc631c621266\``);
await queryRunner.query(`ALTER TABLE \`kpiUserCapacity\` DROP FOREIGN KEY \`FK_1aef260bab99de5f8278082da55\``);
await queryRunner.query(`DROP TABLE \`kpiUserCapacity\``);
}
}