From 057d633a4aa84801a3c7e776e2fef5f5cf722092 Mon Sep 17 00:00:00 2001 From: moon Date: Thu, 22 Feb 2024 22:34:19 -0800 Subject: [PATCH] add pgvector extension fix --- supabase/migrations/20240223051710_remote_schema.sql | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/supabase/migrations/20240223051710_remote_schema.sql b/supabase/migrations/20240223051710_remote_schema.sql index a2962e7..828b350 100644 --- a/supabase/migrations/20240223051710_remote_schema.sql +++ b/supabase/migrations/20240223051710_remote_schema.sql @@ -14,6 +14,18 @@ CREATE SCHEMA IF NOT EXISTS "public"; ALTER SCHEMA "public" OWNER TO "pg_database_owner"; +DO $$ +BEGIN + IF NOT EXISTS ( + SELECT 1 + FROM pg_extension + WHERE extname = 'vector' + ) THEN + CREATE EXTENSION vector + SCHEMA extensions; + END IF; +END $$; + CREATE OR REPLACE FUNCTION "public"."check_similarity_and_insert"("query_table_name" "text", "query_user_id" "uuid", "query_user_ids" "uuid"[], "query_content" "jsonb", "query_room_id" "uuid", "query_embedding" "extensions"."vector", "similarity_threshold" double precision) RETURNS "void" LANGUAGE "plpgsql" AS $$