chore: make vector extension optional for migrations
This commit is contained in:
parent
6685b24239
commit
709f8c3cdf
|
|
@ -1,9 +1,11 @@
|
|||
-- Add migration script here
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
DO $$
|
||||
BEGIN
|
||||
-- Add migration script here
|
||||
CREATE EXTENSION IF NOT EXISTS vector;
|
||||
|
||||
-- create table to store collab embeddings
|
||||
CREATE TABLE IF NOT EXISTS af_collab_embeddings
|
||||
(
|
||||
-- create table to store collab embeddings
|
||||
CREATE TABLE IF NOT EXISTS af_collab_embeddings
|
||||
(
|
||||
fragment_id TEXT NOT NULL PRIMARY KEY,
|
||||
oid TEXT NOT NULL,
|
||||
partition_key INTEGER NOT NULL,
|
||||
|
|
@ -12,6 +14,11 @@ CREATE TABLE IF NOT EXISTS af_collab_embeddings
|
|||
content TEXT,
|
||||
embedding VECTOR(1536),
|
||||
FOREIGN KEY (oid, partition_key) REFERENCES af_collab (oid, partition_key) ON DELETE CASCADE
|
||||
);
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS af_collab_embeddings_similarity_idx ON af_collab_embeddings USING hnsw (embedding vector_cosine_ops);
|
||||
CREATE INDEX IF NOT EXISTS af_collab_embeddings_similarity_idx ON af_collab_embeddings USING hnsw (embedding vector_cosine_ops);
|
||||
|
||||
EXCEPTION WHEN OTHERS THEN
|
||||
RAISE NOTICE 'could not create "vector" extension, ignoring this migration';
|
||||
END;
|
||||
$$ LANGUAGE plpgsql;
|
||||
Loading…
Reference in New Issue