High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
perf(server): index updateId on asset_face, stack and workflow (#32432)
bo0tzz9df807ed4a95
diff --git a/server/src/schema/migrations/1792517020180-AddUpdateIdIndexes.ts b/server/src/schema/migrations/1792517020180-AddUpdateIdIndexes.tsnew file mode 100644index 0000000000..8817299989--- /dev/null+++ b/server/src/schema/migrations/1792517020180-AddUpdateIdIndexes.ts@@ -0,0 +1,13 @@+import { Kysely, sql } from 'kysely';++export async function up(db: Kysely<any>): Promise<void> {+ await sql`CREATE INDEX "stack_updateId_idx" ON "stack" ("updateId");`.execute(db);+ await sql`CREATE INDEX "asset_face_updateId_idx" ON "asset_face" ("updateId");`.execute(db);+ await sql`CREATE INDEX "workflow_updateId_idx" ON "workflow" ("updateId");`.execute(db);+}++export async function down(db: Kysely<any>): Promise<void> {+ await sql`DROP INDEX "stack_updateId_idx";`.execute(db);+ await sql`DROP INDEX "workflow_updateId_idx";`.execute(db);+ await sql`DROP INDEX "asset_face_updateId_idx";`.execute(db);+}diff --git a/server/src/schema/migrations/ORDER b/server/src/schema/migrations/ORDERindex 29bc7eaf77..a334973b43 100644--- a/server/src/schema/migrations/ORDER+++ b/server/src/schema/migrations/ORDER@@ -100,3 +100,4 @@1790693088454-AddPersonUserTableSharedBySharedWithConstraint1792213725597-AddAssetFaceAssetState1792511451454-AddPasskeyTable+1792517020180-AddUpdateIdIndexesdiff --git a/server/src/schema/tables/asset-face.table.ts b/server/src/schema/tables/asset-face.table.tsindex a318cc7283..a613d0c456 100644--- a/server/src/schema/tables/asset-face.table.ts+++ b/server/src/schema/tables/asset-face.table.ts@@ -95,7 +95,7 @@ export class AssetFaceTable {@UpdateDateColumn()updatedAt!: Generated<Timestamp>;- @UpdateIdColumn()+ @UpdateIdColumn({ index: true })updateId!: Generated<string>;@Column({ type: 'boolean', default: true })diff --git a/server/src/schema/tables/stack.table.ts b/server/src/schema/tables/stack.table.tsindex a38b0350de..520338ee29 100644--- a/server/src/schema/tables/stack.table.ts+++ b/server/src/schema/tables/stack.table.ts@@ -31,7 +31,7 @@ export class StackTable {@UpdateDateColumn()updatedAt!: Generated<Timestamp>;- @UpdateIdColumn()+ @UpdateIdColumn({ index: true })updateId!: Generated<string>;//TODO: Add constraint to ensure primary asset exists in the assets arraydiff --git a/server/src/schema/tables/workflow.table.ts b/server/src/schema/tables/workflow.table.tsindex f27f63ef80..a313a2bb69 100644--- a/server/src/schema/tables/workflow.table.ts+++ b/server/src/schema/tables/workflow.table.ts@@ -36,7 +36,7 @@ export class WorkflowTable {@UpdateDateColumn()updatedAt!: Generated<Timestamp>;- @UpdateIdColumn()+ @UpdateIdColumn({ index: true })updateId!: Generated<string>;@Column({ type: 'boolean', default: true })