-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #227 from sotatek-dev/develop
Develop
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
src/database/migrations/1735289167820-add-event-log-status-index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); | ||
} | ||
} |