[backend] Add a new index to the note table for faster generation of following query heuristics
This commit is contained in:
parent
bd63e16e5f
commit
384fb76a26
2 changed files with 14 additions and 0 deletions
|
@ -0,0 +1,13 @@
|
|||
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||
|
||||
export class AddNoteCreatedatUseridIdx1702680809638 implements MigrationInterface {
|
||||
name = 'AddNoteCreatedatUseridIdx1702680809638'
|
||||
|
||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`CREATE INDEX IF NOT EXISTS "IDX_note_createdAt_userId" ON "note" ("createdAt", "userId")`);
|
||||
}
|
||||
|
||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||
await queryRunner.query(`DROP INDEX IF EXISTS "public"."IDX_note_createdAt_userId"`);
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ import { Channel } from "./channel.js";
|
|||
@Index("IDX_NOTE_VISIBLE_USER_IDS", { synchronize: false })
|
||||
@Index("IDX_note_userId_id", ["userId", "id"])
|
||||
@Index("IDX_note_id_userHost", ["id", "userHost"])
|
||||
@Index("IDX_note_createdAt_userId", ["createdAt", "userId"])
|
||||
export class Note {
|
||||
@PrimaryColumn(id())
|
||||
public id: string;
|
||||
|
|
Loading…
Reference in a new issue