Skip to content

Commit

Permalink
feat: Add depositTxHash index to RelayHashInfo table (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
melisaguevara authored Dec 3, 2024
1 parent 5ab0309 commit c168c0a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/indexer-database/src/entities/RelayHashInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
CreateDateColumn,
Entity,
JoinColumn,
Index,
OneToOne,
PrimaryGeneratedColumn,
Unique,
Expand All @@ -24,6 +25,8 @@ export enum RelayStatus {

@Entity()
@Unique("UK_relayHashInfo_relayHash", ["relayHash"])
@Index("IX_rhi_originChainId_depositId", ["originChainId", "depositId"])
@Index("IX_rhi_depositTxHash", ["depositTxHash"])
export class RelayHashInfo {
@PrimaryGeneratedColumn()
id: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class RelayHashInfo1733247042958 implements MigrationInterface {
name = "RelayHashInfo1733247042958";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE INDEX "IX_rhi_depositTxHash" ON "relay_hash_info" ("depositTxHash") `,
);
await queryRunner.query(
`CREATE INDEX "IX_rhi_originChainId_depositId" ON "relay_hash_info" ("originChainId", "depositId") `,
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`DROP INDEX "public"."IX_rhi_originChainId_depositId"`,
);
await queryRunner.query(`DROP INDEX "public"."IX_rhi_depositTxHash"`);
}
}

0 comments on commit c168c0a

Please sign in to comment.