perf(server): index asset (ownerId, updateId) for sync (#32624)

(cherry picked from commit 73603bcafe5d1e52434f736476d07c9578f3b888)
This commit is contained in:
bo0tzz
2026-10-28 20:41:28 +03:00
committed by Codex
parent 7fb7699c06
commit 64d50dc4b7
3 changed files with 11 additions and 0 deletions
@@ -0,0 +1,9 @@
import { Kysely, sql } from 'kysely';
export async function up(db: Kysely<any>): Promise<void> {
await sql`CREATE INDEX "asset_ownerId_updateId_idx" ON "asset" ("ownerId", "updateId");`.execute(db);
}
export async function down(db: Kysely<any>): Promise<void> {
await sql`DROP INDEX "asset_ownerId_updateId_idx";`.execute(db);
}
+1
View File
@@ -101,3 +101,4 @@
1792213725597-AddAssetFaceAssetState
1792511451454-AddPasskeyTable
1792517020180-AddUpdateIdIndexes
1792568637987-AddAssetOwnerIdUpdateIdIndex
+1
View File
@@ -56,6 +56,7 @@ import { ASSET_CHECKSUM_CONSTRAINT } from 'src/utils/database.js';
})
@Index({ columns: ['originalPath', 'libraryId'] })
@Index({ columns: ['id', 'stackId'] })
@Index({ columns: ['ownerId', 'updateId'] })
@Index({
name: 'asset_originalFilename_trigram_idx',
using: 'gin',