summaryrefslogtreecommitdiff
path: root/packages/backend/src/models/Note.ts
diff options
context:
space:
mode:
authorYS <47836716+yszkst@users.noreply.github.com>2024-01-15 08:19:27 +0900
committerGitHub <noreply@github.com>2024-01-15 08:19:27 +0900
commitd92aaf81c42dc91a915d38168996536d19d36cf8 (patch)
tree5ac23c4d6762713a792a88764e0a92766aa0e873 /packages/backend/src/models/Note.ts
parentenhance(frontend) 日本語の拡張絵文字辞書を追加 (#12855) (diff)
downloadsharkey-d92aaf81c42dc91a915d38168996536d19d36cf8.tar.gz
sharkey-d92aaf81c42dc91a915d38168996536d19d36cf8.tar.bz2
sharkey-d92aaf81c42dc91a915d38168996536d19d36cf8.zip
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>
Diffstat (limited to 'packages/backend/src/models/Note.ts')
-rw-r--r--packages/backend/src/models/Note.ts11
1 files changed, 4 insertions, 7 deletions
diff --git a/packages/backend/src/models/Note.ts b/packages/backend/src/models/Note.ts
index a4358b9ba6..dee2560b7c 100644
--- a/packages/backend/src/models/Note.ts
+++ b/packages/backend/src/models/Note.ts
@@ -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: '{}',
})