From 056f40ab4cdeee3af444e2deb89cd83ec0f25e2c Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 17 May 2024 09:41:02 +0700 Subject: [PATCH] migrate --- src/entities/ProfileSalaryHistory.ts | 12 ++++++------ ..._table_ProfileSalaryHistory_delete_profileId.ts | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 src/migration/1715913482491-update_table_ProfileSalaryHistory_delete_profileId.ts diff --git a/src/entities/ProfileSalaryHistory.ts b/src/entities/ProfileSalaryHistory.ts index b1101d07..28785f60 100644 --- a/src/entities/ProfileSalaryHistory.ts +++ b/src/entities/ProfileSalaryHistory.ts @@ -14,12 +14,12 @@ import { ProfileSalary } from "./ProfileSalary"; @Entity("profileSalaryHistory") export class ProfileSalaryHistory extends EntityBase { - @Column({ - length: 40, - comment: "คีย์นอก(FK)ของตาราง profile", - type: "uuid", - }) - profileId: string; + // @Column({ + // length: 40, + // comment: "คีย์นอก(FK)ของตาราง profile", + // type: "uuid", + // }) + // profileId: string; @Column({ comment: "วันที่", diff --git a/src/migration/1715913482491-update_table_ProfileSalaryHistory_delete_profileId.ts b/src/migration/1715913482491-update_table_ProfileSalaryHistory_delete_profileId.ts new file mode 100644 index 00000000..6aa2a1f5 --- /dev/null +++ b/src/migration/1715913482491-update_table_ProfileSalaryHistory_delete_profileId.ts @@ -0,0 +1,14 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileSalaryHistoryDeleteProfileId1715913482491 implements MigrationInterface { + name = 'UpdateTableProfileSalaryHistoryDeleteProfileId1715913482491' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` DROP COLUMN \`profileId\``); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalaryHistory\` ADD \`profileId\` varchar(40) NOT NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`); + } + +}