From 660deeb3a4b29fdbff21dd779afb65a979c705bf Mon Sep 17 00:00:00 2001 From: Kittapath Date: Mon, 13 May 2024 17:52:55 +0700 Subject: [PATCH] migrate --- ...18469-update_table_profileemployee_add_pk3.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/migration/1715597418469-update_table_profileemployee_add_pk3.ts diff --git a/src/migration/1715597418469-update_table_profileemployee_add_pk3.ts b/src/migration/1715597418469-update_table_profileemployee_add_pk3.ts new file mode 100644 index 00000000..5e1c4c3b --- /dev/null +++ b/src/migration/1715597418469-update_table_profileemployee_add_pk3.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileemployeeAddPk31715597418469 implements MigrationInterface { + name = 'UpdateTableProfileemployeeAddPk31715597418469' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileOther\` ADD \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee'`); + await queryRunner.query(`ALTER TABLE \`profileOther\` ADD CONSTRAINT \`FK_b7ef3007bce554a41bdb896ed96\` 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 \`profileOther\` DROP FOREIGN KEY \`FK_b7ef3007bce554a41bdb896ed96\``); + await queryRunner.query(`ALTER TABLE \`profileOther\` DROP COLUMN \`profileEmployeeId\``); + } + +}