mirror of
https://github.com/immich-app/immich.git
synced 2025-12-27 17:24:58 +03:00
* chore(server): don't insert embeddings if the model has changed We're moving away from the heuristic of waiting for queues to complete. The job which inserts embeddings can simply check if the model has changed before inserting, rather than attempting to lock the queue. * more robust dim size update * use check constraint * index command cleanup * add create statement * update medium test, create appropriate extension * new line * set dimension size when running on all assets * why does it want braces smh * take 2 --------- Co-authored-by: mertalev <101130780+mertalev@users.noreply.github.com>
20 lines
789 B
TypeScript
20 lines
789 B
TypeScript
import { ConfigRepository } from 'src/repositories/config.repository';
|
|
import { vectorIndexQuery } from 'src/utils/database';
|
|
import { MigrationInterface, QueryRunner } from 'typeorm';
|
|
|
|
const vectorExtension = new ConfigRepository().getEnv().database.vectorExtension;
|
|
|
|
export class AddCLIPEmbeddingIndex1700713994428 implements MigrationInterface {
|
|
name = 'AddCLIPEmbeddingIndex1700713994428';
|
|
|
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`SET search_path TO "$user", public, vectors`);
|
|
|
|
await queryRunner.query(vectorIndexQuery({ vectorExtension, table: 'smart_search', indexName: 'clip_index' }));
|
|
}
|
|
|
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
await queryRunner.query(`DROP INDEX IF EXISTS clip_index`);
|
|
}
|
|
}
|