From f73e7cc5ebfb35c3a6021ea17eea245f981b32c0 Mon Sep 17 00:00:00 2001 From: Tan Hoang Date: Wed, 25 Sep 2024 17:09:11 +0700 Subject: [PATCH] feat: add index for tx_hash_lock --- .../1727258557893-create-index-event-logs.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/database/migrations/1727258557893-create-index-event-logs.ts diff --git a/src/database/migrations/1727258557893-create-index-event-logs.ts b/src/database/migrations/1727258557893-create-index-event-logs.ts new file mode 100644 index 0000000..496fa16 --- /dev/null +++ b/src/database/migrations/1727258557893-create-index-event-logs.ts @@ -0,0 +1,18 @@ +import { MigrationInterface, QueryRunner, TableIndex } from 'typeorm'; + +export class CreateIndexEventLogs1727258557893 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.createIndex( + 'event_logs', + new TableIndex({ + name: 'index-tx-hash-lock', + columnNames: ['tx_hash_lock'], + isUnique: true, + }), + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropIndex('event_logs', 'index-tx-hash-lock'); + } +}