diff --git a/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts b/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts index 70f5c8fe..c1464a54 100644 --- a/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts +++ b/src/migration/1715914699824-update_table_ProfileSalaryHistory_delete_profileId1.ts @@ -6,11 +6,11 @@ export class UpdateTableProfileSalaryHistoryDeleteProfileId11715914699824 implem 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`); + // 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 \`profileSalary\` DROP FOREIGN KEY \`FK_f5758428d496b6d2a051c8af92b\``); await queryRunner.query(`ALTER TABLE \`profileEmployeeHistory\` DROP COLUMN \`nationality\``); await queryRunner.query(`ALTER TABLE \`profileEmployee\` DROP COLUMN \`nationality\``); } diff --git a/src/migration/1715919796147-update_table_ProfileSalaryHistory_delete_profileId2.ts b/src/migration/1715919796147-update_table_ProfileSalaryHistory_delete_profileId2.ts new file mode 100644 index 00000000..ae204e7c --- /dev/null +++ b/src/migration/1715919796147-update_table_ProfileSalaryHistory_delete_profileId2.ts @@ -0,0 +1,16 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class UpdateTableProfileSalaryHistoryDeleteProfileId21715919796147 implements MigrationInterface { + name = 'UpdateTableProfileSalaryHistoryDeleteProfileId21715919796147' + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE \`profileSalary\` ADD \`profileEmployeeId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง ProfileEmployee'`); + 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 \`profileSalary\` DROP COLUMN \`profileEmployeeId\``); + } + +}