From 92ac9c21ad4c2e199909132eb5d203bf05d06374 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sun, 12 Sep 2021 22:17:22 +0300 Subject: [PATCH] Add index on messages.is_bot --- .../1631474131804-AddIndexToIsBot.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 backend/src/migrations/1631474131804-AddIndexToIsBot.ts diff --git a/backend/src/migrations/1631474131804-AddIndexToIsBot.ts b/backend/src/migrations/1631474131804-AddIndexToIsBot.ts new file mode 100644 index 00000000..db839d97 --- /dev/null +++ b/backend/src/migrations/1631474131804-AddIndexToIsBot.ts @@ -0,0 +1,21 @@ +import { MigrationInterface, QueryRunner, TableIndex } from "typeorm"; + +export class AddIndexToIsBot1631474131804 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.createIndex( + "messages", + new TableIndex({ + columnNames: ["is_bot"], + }), + ); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.dropIndex( + "messages", + new TableIndex({ + columnNames: ["is_bot"], + }), + ); + } +}