From 11eca136a0f22771d8d82ef3a3ff57d27e377c24 Mon Sep 17 00:00:00 2001 From: Marcel Gerber Date: Fri, 14 Jun 2024 14:23:35 +0100 Subject: [PATCH] db: add index on `posts_gdocs.slug` column --- .../1718371124648-AddGdocsPostsSlugIndex.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 db/migration/1718371124648-AddGdocsPostsSlugIndex.ts diff --git a/db/migration/1718371124648-AddGdocsPostsSlugIndex.ts b/db/migration/1718371124648-AddGdocsPostsSlugIndex.ts new file mode 100644 index 00000000000..8799ffbe257 --- /dev/null +++ b/db/migration/1718371124648-AddGdocsPostsSlugIndex.ts @@ -0,0 +1,15 @@ +import { MigrationInterface, QueryRunner } from "typeorm" + +export class AddGdocsPostsSlugIndex1718371124648 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`-- sql + ALTER TABLE posts_gdocs ADD INDEX idx_posts_gdocs_slug (slug(100)); + `) + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`-- sql + DROP INDEX idx_posts_gdocs_slug ON posts_gdocs; + `) + } +}