From c7ca78c13c3495028359794287c7f730f187695f Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 7 Jun 2024 13:30:09 +0700 Subject: [PATCH] migrate --- ...1744850-update_table_Profileemp_add_group2.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/migration/1717741744850-update_table_Profileemp_add_group2.ts diff --git a/src/migration/1717741744850-update_table_Profileemp_add_group2.ts b/src/migration/1717741744850-update_table_Profileemp_add_group2.ts new file mode 100644 index 00000000..ddc4f984 --- /dev/null +++ b/src/migration/1717741744850-update_table_Profileemp_add_group2.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileempAddGroup21717741744850 implements MigrationInterface { + name = 'UpdateTableProfileempAddGroup21717741744850' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployeeEmployment\` ADD \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeEmployment\` ADD CONSTRAINT \`FK_229d969d15790aae298399f9303\` FOREIGN KEY (\`profileEmployeeId\`) REFERENCES \`profileEmployee\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployeeEmployment\` DROP FOREIGN KEY \`FK_229d969d15790aae298399f9303\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeEmployment\` DROP COLUMN \`profileEmployeeId\``); + } + +}