refactor: noteテーブルのインデックス整理と配列カラムへのクエリでインデックスを使うように (#12993)

* Optimize note model index

* enhance(backend): ANY()をやめる (MisskeyIO#239)

* add small e2e test drive endpoint

---------

Co-authored-by: まっちゃとーにゅ <17376330+u1-liquid@users.noreply.github.com>
This commit is contained in:
YS
2024-01-15 08:19:27 +09:00
committed by GitHub
parent 0ea8e0c25c
commit d92aaf81c4
9 changed files with 188 additions and 27 deletions

View File

@@ -11,9 +11,6 @@ import { MiChannel } from './Channel.js';
import type { MiDriveFile } from './DriveFile.js';
@Entity('note')
@Index('IDX_NOTE_TAGS', { synchronize: false })
@Index('IDX_NOTE_MENTIONS', { synchronize: false })
@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false })
export class MiNote {
@PrimaryColumn(id())
public id: string;
@@ -133,7 +130,7 @@ export class MiNote {
})
public url: string | null;
@Index()
@Index('IDX_NOTE_FILE_IDS', { synchronize: false })
@Column({
...id(),
array: true, default: '{}',
@@ -145,14 +142,14 @@ export class MiNote {
})
public attachedFileTypes: string[];
@Index()
@Index('IDX_NOTE_VISIBLE_USER_IDS', { synchronize: false })
@Column({
...id(),
array: true, default: '{}',
})
public visibleUserIds: MiUser['id'][];
@Index()
@Index('IDX_NOTE_MENTIONS', { synchronize: false })
@Column({
...id(),
array: true, default: '{}',
@@ -174,7 +171,7 @@ export class MiNote {
})
public emojis: string[];
@Index()
@Index('IDX_NOTE_TAGS', { synchronize: false })
@Column('varchar', {
length: 128, array: true, default: '{}',
})