Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/email-marketing/entities/ab-test-variant.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
Column,
ManyToOne,
JoinColumn,
Index,
VersionColumn,
} from 'typeorm';
import { ApiProperty } from '@nestjs/swagger';
Expand All @@ -13,6 +14,7 @@ import { ABTest } from './ab-test.entity';
* Represents the aBTest Variant entity.
*/
@Entity('ab_test_variants')
@Index('IDX_ab_test_variants_abTestId_weight', ['abTestId', 'weight'])
export class ABTestVariant {
@ApiProperty()
@PrimaryGeneratedColumn('uuid')
Expand Down
17 changes: 17 additions & 0 deletions src/migrations/1802000000000-add-ab-test-variant-indexes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { MigrationInterface, QueryRunner, TableIndex } from 'typeorm';

export class AddABTestVariantIndexes1802000000000 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.createIndex(
'ab_test_variants',
new TableIndex({
name: 'IDX_ab_test_variants_abTestId_weight',
columnNames: ['abTestId', 'weight'],
}),
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.dropIndex('ab_test_variants', 'IDX_ab_test_variants_abTestId_weight');
}
}
Loading