From 4676b62a6fb20c0bb61384f45f8ef72ad1e647b1 Mon Sep 17 00:00:00 2001 From: Kittapath Date: Thu, 16 May 2024 14:10:08 +0700 Subject: [PATCH] no message --- src/entities/ProfileSalary.ts | 2 ++ ...update_table_ProfileAvatar_add_isactive3.ts | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 src/migration/1715843317765-update_table_ProfileAvatar_add_isactive3.ts diff --git a/src/entities/ProfileSalary.ts b/src/entities/ProfileSalary.ts index 908f8db6..5a423a3a 100644 --- a/src/entities/ProfileSalary.ts +++ b/src/entities/ProfileSalary.ts @@ -16,9 +16,11 @@ import { ProfileSalaryHistory } from "./ProfileSalaryHistory"; @Entity("profileSalary") export class ProfileSalary extends EntityBase { @Column({ + nullable: true, length: 40, comment: "คีย์นอก(FK)ของตาราง profile", type: "uuid", + default: null, }) profileId: string; diff --git a/src/migration/1715843317765-update_table_ProfileAvatar_add_isactive3.ts b/src/migration/1715843317765-update_table_ProfileAvatar_add_isactive3.ts new file mode 100644 index 00000000..300e279c --- /dev/null +++ b/src/migration/1715843317765-update_table_ProfileAvatar_add_isactive3.ts @@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileAvatarAddIsactive31715843317765 implements MigrationInterface { + name = 'UpdateTableProfileAvatarAddIsactive31715843317765' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``); + await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`profileId\` \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`); + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalary\` DROP FOREIGN KEY \`FK_7534d36579c78107ba08a96be6f\``); + await queryRunner.query(`ALTER TABLE \`profileSalary\` CHANGE \`profileId\` \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`); + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_7534d36579c78107ba08a96be6f\` FOREIGN KEY (\`profileId\`) REFERENCES \`profile\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`); + } + +}