mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 01:11:20 +03:00
20 lines
615 B
TypeScript
20 lines
615 B
TypeScript
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
||
|
|
|
||
|
|
export class AddFaceEmbeddingIndex1700714033632 implements MigrationInterface {
|
||
|
|
name = 'AddFaceEmbeddingIndex1700714033632';
|
||
|
|
|
||
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.query(`
|
||
|
|
CREATE INDEX IF NOT EXISTS face_index ON asset_faces
|
||
|
|
USING vectors (embedding cosine_ops) WITH (options = $$
|
||
|
|
[indexing.hnsw]
|
||
|
|
m = 16
|
||
|
|
ef_construction = 300
|
||
|
|
$$);`);
|
||
|
|
}
|
||
|
|
|
||
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||
|
|
await queryRunner.query(`DROP INDEX IF EXISTS face_index`);
|
||
|
|
}
|
||
|
|
}
|