Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
kittapath 2024-10-21 16:08:32 +07:00
commit 96edba3c08

View file

@ -1,22 +0,0 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class UpdateTableMigration102120241729492903054 implements MigrationInterface {
name = 'UpdateTableMigration102120241729492903054'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE \`commandSend\` (\`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 'คำนำหน้า', \`firstName\` 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 \`profileSalaryHistory\` ADD \`commandId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง command'`);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD CONSTRAINT \`FK_71884cff2519003c997c4129374\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`commandSend\` ADD CONSTRAINT \`FK_4f257ba4ce200ddc0726156a00d\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD CONSTRAINT \`FK_8ba1f49c8315bf86848ebcb29f5\` FOREIGN KEY (\`commandId\`) REFERENCES \`command\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP FOREIGN KEY \`FK_8ba1f49c8315bf86848ebcb29f5\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP FOREIGN KEY \`FK_4f257ba4ce200ddc0726156a00d\``);
await queryRunner.query(`ALTER TABLE \`commandSend\` DROP FOREIGN KEY \`FK_71884cff2519003c997c4129374\``);
await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`commandId\``);
await queryRunner.query(`DROP TABLE \`commandSend\``);
}
}