fix name relation

This commit is contained in:
AdisakKanthawilang 2024-05-13 16:33:34 +07:00
parent 996549864e
commit 3ba4ba6d3f
2 changed files with 19 additions and 1 deletions

View file

@ -68,6 +68,6 @@ export class KpiUserEvaluationReasonPlan extends EntityBase {
kpiUserPlannedId: string;
@ManyToOne(() => KpiUserPlanned, (kpiUserPlanned) => kpiUserPlanned.kpiUserEvaluationReasonPlans)
@JoinColumn({ name: "kpiUserPlanId" })
@JoinColumn({ name: "kpiUserPlannedId" })
kpiUserPlanned: KpiUserPlanned;
}

View file

@ -0,0 +1,18 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class RenameRelationsKpiUserPlanned1715592621069 implements MigrationInterface {
name = 'RenameRelationsKpiUserPlanned1715592621069'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluationReasonPlan\` DROP FOREIGN KEY \`FK_6eda960b0eada6c174ac4a6ffb8\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluationReasonPlan\` DROP COLUMN \`kpiUserPlanId\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluationReasonPlan\` ADD CONSTRAINT \`FK_704d587bd08b64d8ecb577bcebe\` FOREIGN KEY (\`kpiUserPlannedId\`) REFERENCES \`kpiUserPlanned\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluationReasonPlan\` DROP FOREIGN KEY \`FK_704d587bd08b64d8ecb577bcebe\``);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluationReasonPlan\` ADD \`kpiUserPlanId\` varchar(36) NULL`);
await queryRunner.query(`ALTER TABLE \`kpiUserEvaluationReasonPlan\` ADD CONSTRAINT \`FK_6eda960b0eada6c174ac4a6ffb8\` FOREIGN KEY (\`kpiUserPlanId\`) REFERENCES \`kpiUserPlanned\`(\`id\`) ON DELETE NO ACTION ON UPDATE NO ACTION`);
}
}