diff --git a/src/migrations/1562838838927-AddMoreIndicesToVCAlerts.ts b/src/migrations/1562838838927-AddMoreIndicesToVCAlerts.ts new file mode 100644 index 00000000..dffb505f --- /dev/null +++ b/src/migrations/1562838838927-AddMoreIndicesToVCAlerts.ts @@ -0,0 +1,31 @@ +import { MigrationInterface, QueryRunner, TableIndex } from "typeorm"; + +export class AddMoreIndicesToVCAlerts1562838838927 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + const table = await queryRunner.getTable("vc_alerts"); + await table.addIndex( + new TableIndex({ + columnNames: ["requestor_id"], + }), + ); + await table.addIndex( + new TableIndex({ + columnNames: ["expires_at"], + }), + ); + } + + public async down(queryRunner: QueryRunner): Promise { + const table = await queryRunner.getTable("vc_alerts"); + await table.removeIndex( + new TableIndex({ + columnNames: ["requestor_id"], + }), + ); + await table.removeIndex( + new TableIndex({ + columnNames: ["expires_at"], + }), + ); + } +}