Skip to content

Commit

Permalink
add uniquness constraint to estimatedclustedMatching
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosQ96 committed Jan 22, 2025
1 parent 0edb4e8 commit dc57537
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions migration/1737553475189-addUniquenessToEstimatedClusterMatching.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { MigrationInterface, QueryRunner, TableUnique } from 'typeorm';

export class addUniquenessToEstimatedClusterMatching1737553475189
implements MigrationInterface
{
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createUniqueConstraint(
'estimated_cluster_matching',
new TableUnique({
name: 'unique_projectId_qfRoundId',
columnNames: ['projectId', 'qfRoundId'],
}),
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropUniqueConstraint(
'estimated_cluster_matching',
'unique_projectId_qfRoundId',
);
}
}
2 changes: 2 additions & 0 deletions src/entities/estimatedClusterMatching.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Entity,
ManyToOne,
JoinColumn,
Unique,
} from 'typeorm';
import { Project } from './project';

Expand All @@ -15,6 +16,7 @@ import { Project } from './project';
'projectId',
'qfRoundId',
])
@Unique('unique_projectId_qfRoundId', ['projectId', 'qfRoundId'])
@Index('estimated_cluster_matching_matching', ['matching'])
@ObjectType()
export class EstimatedClusterMatching extends BaseEntity {
Expand Down

0 comments on commit dc57537

Please sign in to comment.