This commit is contained in:
Caipira 2025-09-21 15:56:01 +09:00 committed by GitHub
commit fe2c3eb209
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,19 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
export class OptimizeDriveFilesQuery1756824506000 {
name = 'OptimizeDriveFilesQuery1756824506000'
async up(queryRunner) {
// Create optimized composite index for drive files query performance
await queryRunner.query(`DROP INDEX "IDX_860fa6f6c7df5bb887249fba22"`);
await queryRunner.query(`CREATE INDEX "IDX_a76118b66adb3228e0ee69c281" ON "drive_file" ("userId", "id" DESC)`);
}
async down(queryRunner) {
await queryRunner.query(`DROP INDEX "IDX_a76118b66adb3228e0ee69c281"`);
await queryRunner.query(`CREATE INDEX "IDX_860fa6f6c7df5bb887249fba22" ON "drive_file" ("userId")`);
}
}

View File

@ -10,11 +10,11 @@ import { MiDriveFolder } from './DriveFolder.js';
@Entity('drive_file')
@Index(['userId', 'folderId', 'id'])
@Index(['userId', 'id'])
export class MiDriveFile {
@PrimaryColumn(id())
public id: string;
@Index()
@Column({
...id(),
nullable: true,