From 91b177190cfad553d620eb30b125312fa29b30be Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 17 May 2024 09:50:19 +0700 Subject: [PATCH 1/2] add nationality --- src/entities/ProfileEmployee.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/entities/ProfileEmployee.ts b/src/entities/ProfileEmployee.ts index dcfabc9f..6dcc648a 100644 --- a/src/entities/ProfileEmployee.ts +++ b/src/entities/ProfileEmployee.ts @@ -198,6 +198,14 @@ export class ProfileEmployee extends EntityBase { }) telephoneNumber: string; + @Column({ + nullable: true, + comment: "สัญชาติ", + length: 255, + default: null, + }) + nationality: string; + @Column({ nullable: true, comment: "เพศ", @@ -441,6 +449,7 @@ export class CreateProfileEmployee { // religion: string | null; posLevelId: string | null; posTypeId: string | null; + // nationality: string | null; // gender: string | null; // relationship: string | null; // bloodGroup: string | null; @@ -464,6 +473,7 @@ export type UpdateProfileEmployee = { religion: string | null; posLevelId?: string | null; posTypeId?: string | null; + nationality?: string | null; gender?: string | null; relationship?: string | null; bloodGroup?: string | null; From 5254eaa9c9671247f41edf2e401e10c03fe5bd1a Mon Sep 17 00:00:00 2001 From: Kittapath Date: Fri, 17 May 2024 10:00:21 +0700 Subject: [PATCH 2/2] migrate --- ...e_ProfileSalaryHistory_delete_profileId1.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts diff --git a/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts b/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts new file mode 100644 index 00000000..70f5c8fe --- /dev/null +++ b/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts @@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileSalaryHistoryDeleteProfileId11715914699824 implements MigrationInterface { + name = 'UpdateTableProfileSalaryHistoryDeleteProfileId11715914699824' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileEmployee\` ADD \`nationality\` varchar(255) NULL COMMENT 'สัญชาติ'`); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` ADD \`nationality\` varchar(255) NULL COMMENT 'สัญชาติ'`); + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD CONSTRAINT \`FK_f5758428d496b6d2a051c8af92b\` 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 \`profileSalary\` DROP FOREIGN KEY \`FK_f5758428d496b6d2a051c8af92b\``); + await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`nationality\``); + await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`nationality\``); + } + +}