mirror of
https://github.com/immich-app/immich.git
synced 2026-03-11 20:31:07 -04:00
19 lines
568 B
TypeScript
19 lines
568 B
TypeScript
import { Column, ForeignKeyColumn, Index, Table } from '@immich/sql-tools';
|
|
import { AssetTable } from 'src/schema/tables/asset.table';
|
|
|
|
@Table({ name: 'smart_search' })
|
|
@Index({
|
|
name: 'clip_index',
|
|
using: 'hnsw',
|
|
expression: `embedding vector_cosine_ops`,
|
|
with: `ef_construction = 300, m = 16`,
|
|
synchronize: false,
|
|
})
|
|
export class SmartSearchTable {
|
|
@ForeignKeyColumn(() => AssetTable, { onDelete: 'CASCADE', primary: true })
|
|
assetId!: string;
|
|
|
|
@Column({ type: 'vector', length: 512, storage: 'external', synchronize: false })
|
|
embedding!: string;
|
|
}
|