From 375d0320fce9654515d3577d92255b053d860967 Mon Sep 17 00:00:00 2001 From: mertalev <101130780+mertalev@users.noreply.github.com> Date: Sat, 18 Nov 2023 00:29:18 -0500 Subject: [PATCH] migration fixes --- server/src/infra/database.config.ts | 2 +- .../src/infra/migrations/vector/1699746198141-UsePgVectors.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/infra/database.config.ts b/server/src/infra/database.config.ts index 9c7364d65..c3e04ca7d 100644 --- a/server/src/infra/database.config.ts +++ b/server/src/infra/database.config.ts @@ -33,7 +33,7 @@ export async function initDataSource(): Promise { const dataSource = await new DataSource(databaseConfig).initialize(); const hasVectorExtension = (await dataSource.query( - `SELECT * FROM pg_extension WHERE name = 'vectors'`, + `SELECT * FROM pg_available_extensions WHERE name = 'vectors'`, )).length > 0; if (hasVectorExtension) { diff --git a/server/src/infra/migrations/vector/1699746198141-UsePgVectors.ts b/server/src/infra/migrations/vector/1699746198141-UsePgVectors.ts index 16e85ee30..2bde7ad10 100644 --- a/server/src/infra/migrations/vector/1699746198141-UsePgVectors.ts +++ b/server/src/infra/migrations/vector/1699746198141-UsePgVectors.ts @@ -5,11 +5,11 @@ export class UsePgVectors1699746198141 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { const faceDimQuery = await queryRunner.query(` - SELECT CARDINALITY(embedding) as dimsize + SELECT CARDINALITY(embedding::real[]) as dimsize FROM asset_faces LIMIT 1`); const clipDimQuery = await queryRunner.query(` - SELECT CARDINALITY("clipEmbedding") as dimsize + SELECT CARDINALITY("clipEmbedding"::real[]) as dimsize FROM smart_info LIMIT 1`);