no message

This commit is contained in:
kittapath 2024-09-24 16:42:24 +07:00
parent 317920ad0d
commit b2b97aecf0
6 changed files with 225 additions and 6 deletions

View file

@ -0,0 +1,24 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateCommandAddPositiondetail1727167169710 implements MigrationInterface {
name = 'UpdateCommandAddPositiondetail1727167169710'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandRecive\` (\`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', \`citizenId\` varchar(255) NULL COMMENT 'เลขประจำตัวประชาชน', \`prefix\` varchar(255) NULL COMMENT 'คำนำหน้า', \`fristName\` varchar(255) NULL COMMENT 'ชื่อ', \`lastName\` varchar(255) NULL COMMENT 'สกุล', \`position\` varchar(255) NULL COMMENT 'ตำแหน่ง', \`org\` varchar(255) NULL COMMENT 'หน่วยงาน', \`commandId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง command', \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile', PRIMARY KEY (\`id\`)) ENGINE=InnoDB`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`positionDetail\` text NULL COMMENT 'ตำแหน่ง'`);
await queryRunner.query(`ALTER TABLE \`command\` ADD \`commandSalaryId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง commandSalary'`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD CONSTRAINT \`FK_66de028b0d8e4cff62bc43a58be\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD CONSTRAINT \`FK_fb29bfd315d0d43d0b49b362995\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`command\` ADD CONSTRAINT \`FK_c85f006fc84cebf07b0980c6b94\` FOREIGN KEY (\`commandSalaryId\`) REFERENCES \`commandSalary\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`command\` DROP FOREIGN KEY \`FK_c85f006fc84cebf07b0980c6b94\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP FOREIGN KEY \`FK_fb29bfd315d0d43d0b49b362995\``);
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP FOREIGN KEY \`FK_66de028b0d8e4cff62bc43a58be\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`commandSalaryId\``);
await queryRunner.query(`ALTER TABLE \`command\` DROP COLUMN \`positionDetail\``);
await queryRunner.query(`DROP TABLE \`commandRecive\``);
}
}