Skip to content

Commit

Permalink
Merge pull request #226 from sotatek-dev/feat/est-api
Browse files Browse the repository at this point in the history
feat: add partial index for status
  • Loading branch information
Sotatek-TanHoang authored Dec 27, 2024
2 parents c9014e4 + 3e13502 commit 5f2fd23
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { MigrationInterface, QueryRunner, TableIndex } from 'typeorm';

import { EEventStatus } from '../../constants/blockchain.constant.js';

export class AddEventLogStatusIndex1735289167820 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> {
return queryRunner.createIndex(
'event_logs',
new TableIndex({
columnNames: ['status'],
name: 'status_partial_index',
where: `status IN('${EEventStatus.WAITING}','${EEventStatus.PROCESSING}','${EEventStatus.FAILED}')`,
}),
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
return queryRunner.dropIndex('event_logs', 'status_partial_index');
}
}

0 comments on commit 5f2fd23

Please sign in to comment.