migration fixes

This commit is contained in:
mertalev 2023-11-18 00:29:18 -05:00
parent 7e65dcabc1
commit 375d0320fc
No known key found for this signature in database
GPG key ID: 9181CD92C0A1C5E3
2 changed files with 3 additions and 3 deletions

View file

@ -33,7 +33,7 @@ export async function initDataSource(): Promise<DataSource> {
const dataSource = await new DataSource(databaseConfig).initialize(); const dataSource = await new DataSource(databaseConfig).initialize();
const hasVectorExtension = (await dataSource.query( const hasVectorExtension = (await dataSource.query(
`SELECT * FROM pg_extension WHERE name = 'vectors'`, `SELECT * FROM pg_available_extensions WHERE name = 'vectors'`,
)).length > 0; )).length > 0;
if (hasVectorExtension) { if (hasVectorExtension) {

View file

@ -5,11 +5,11 @@ export class UsePgVectors1699746198141 implements MigrationInterface {
public async up(queryRunner: QueryRunner): Promise<void> { public async up(queryRunner: QueryRunner): Promise<void> {
const faceDimQuery = await queryRunner.query(` const faceDimQuery = await queryRunner.query(`
SELECT CARDINALITY(embedding) as dimsize SELECT CARDINALITY(embedding::real[]) as dimsize
FROM asset_faces FROM asset_faces
LIMIT 1`); LIMIT 1`);
const clipDimQuery = await queryRunner.query(` const clipDimQuery = await queryRunner.query(`
SELECT CARDINALITY("clipEmbedding") as dimsize SELECT CARDINALITY("clipEmbedding"::real[]) as dimsize
FROM smart_info FROM smart_info
LIMIT 1`); LIMIT 1`);