feat(backend): add indexes for noteId in note_favorite and user_note_pining tables (#17511)

* feat(backend): add indexes for noteId in note_favorite and user_note_pining tables

* reformat
This commit is contained in:
おさむのひと 2026-05-30 12:35:01 +09:00 committed by GitHub
commit 2b016d670f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 28 additions and 0 deletions

View file

@ -11,6 +11,7 @@
### Server
- Enhance: リモートノートクリーニングジョブのスキップ処理のパフォーマンス改善
- Enhance: リモートノートクリーニングジョブの削除対象検索処理のパフォーマンス改善
- Fix: backend バンドルで `@tensorflow/tfjs-node` を external に含めず、起動時に `@mapbox/node-pre-gyp``find()` が backend の package.json を誤検出して `is not node-pre-gyp ready` エラーを永続的に吐く問題を修正

View file

@ -0,0 +1,25 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
const isConcurrentIndexMigrationEnabled = process.env.MISSKEY_MIGRATION_CREATE_INDEX_CONCURRENTLY === '1';
export class NoteIdIndexForPinAndFavorite1780059833698 {
name = 'NoteIdIndexForPinAndFavorite1780059833698';
transaction = isConcurrentIndexMigrationEnabled ? false : undefined;
async up(queryRunner) {
const concurrently = isConcurrentIndexMigrationEnabled ? 'CONCURRENTLY' : '';
await queryRunner.query(`CREATE INDEX ${concurrently} IF NOT EXISTS "IDX_0e00498f180193423c992bc437" ON "note_favorite" ("noteId")`);
await queryRunner.query(`CREATE INDEX ${concurrently} IF NOT EXISTS "IDX_68881008f7c3588ad7ecae471c" ON "user_note_pining" ("noteId")`);
}
async down(queryRunner) {
const concurrently = isConcurrentIndexMigrationEnabled ? 'CONCURRENTLY' : '';
await queryRunner.query(`DROP INDEX ${concurrently} IF EXISTS "public"."IDX_68881008f7c3588ad7ecae471c"`);
await queryRunner.query(`DROP INDEX ${concurrently} IF EXISTS "public"."IDX_0e00498f180193423c992bc437"`);
}
}

View file

@ -24,6 +24,7 @@ export class MiNoteFavorite {
@JoinColumn()
public user: MiUser | null;
@Index()
@Column(id())
public noteId: MiNote['id'];

View file

@ -24,6 +24,7 @@ export class MiUserNotePining {
@JoinColumn()
public user: MiUser | null;
@Index()
@Column(id())
public noteId: MiNote['id'];