@@ -14,7 +14,7 @@ CREATE TABLE IF NOT EXISTS issues (
1414 number INT NOT NULL ,
1515 html_url VARCHAR NOT NULL ,
1616 url VARCHAR NOT NULL ,
17- embedding vector( 1024 ) NOT NULL ,
17+ embedding halfvec( 2560 ) NOT NULL ,
1818 created_at timestamp with time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE ' UTC' ),
1919 updated_at timestamp with time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE ' UTC' )
2020);
@@ -31,14 +31,19 @@ CREATE TABLE IF NOT EXISTS comments (
3131
3232CREATE INDEX IF NOT EXISTS issues_source_id_idx ON issues (source_id);
3333CREATE INDEX IF NOT EXISTS comments_source_id_idx ON comments (source_id);
34- CREATE INDEX IF NOT EXISTS issues_embedding_hnsw_idx ON issues USING hnsw (embedding vector_cosine_ops);
34+ CREATE INDEX IF NOT EXISTS issues_embedding_hnsw_idx ON issues USING hnsw (embedding halfvec_cosine_ops);
35+
36+ CREATE TYPE job_type AS ENUM (' embeddings_regeneration' , ' issue_indexation' );
3537
3638CREATE TABLE IF NOT EXISTS jobs (
3739 id SERIAL PRIMARY KEY ,
38- repository_id VARCHAR NOT NULL UNIQUE,
40+ job_type job_type NOT NULL ,
41+ repository_id VARCHAR UNIQUE,
3942 data JSONB NOT NULL ,
4043 created_at timestamp with time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE ' UTC' ),
4144 updated_at timestamp with time zone NOT NULL DEFAULT (current_timestamp AT TIME ZONE ' UTC' )
4245);
4346
4447CREATE INDEX IF NOT EXISTS jobs_repository_id_idx ON jobs (repository_id);
48+ CREATE INDEX IF NOT EXISTS jobs_job_type_idx ON jobs (job_type);
49+ CREATE UNIQUE INDEX jobs_type_special_idx ON jobs (job_type) WHERE job_type = ' embeddings_regeneration' ;
0 commit comments