From 369d5971d49949036df75affe595377dbff1b097 Mon Sep 17 00:00:00 2001 From: samunohito <46447427+samunohito@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:21:50 +0900 Subject: [PATCH] add index to emoji --- .../1707951601000-optimize-emoji-index.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 packages/backend/migration/1707951601000-optimize-emoji-index.js diff --git a/packages/backend/migration/1707951601000-optimize-emoji-index.js b/packages/backend/migration/1707951601000-optimize-emoji-index.js new file mode 100644 index 0000000000..e1147673e6 --- /dev/null +++ b/packages/backend/migration/1707951601000-optimize-emoji-index.js @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class OptimizeEmojiIndex1707951601000 { + name = 'OptimizeEmojiIndex1707951601000' + + async up(queryRunner) { + await queryRunner.query(`CREATE INDEX "IDX_EMOJI_ALIASES_IDS" ON "emoji" using gin ("aliases")`) + await queryRunner.query(`CREATE INDEX "IDX_EMOJI_ROLE_IDS" ON "emoji" using gin ("roleIdsThatCanBeUsedThisEmojiAsReaction")`) + await queryRunner.query(`CREATE INDEX "IDX_EMOJI_CATEGORY" ON "emoji" ("category")`) + } + + async down(queryRunner) { + await queryRunner.query(`DROP INDEX "IDX_EMOJI_CATEGORY"`) + await queryRunner.query(`DROP INDEX "IDX_EMOJI_ROLE_IDS"`) + await queryRunner.query(`DROP INDEX "IDX_EMOJI_ALIASES_IDS"`) + } +}