Skip to content

Commit

Permalink
chore: sync the storage schemas (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingwanying authored Oct 15, 2024
1 parent ab76db6 commit 50f0255
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 93 deletions.
87 changes: 0 additions & 87 deletions client/types/database.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -462,80 +462,6 @@ export type Database = {
};
Returns: unknown;
};
match_antd_doc: {
Args: {
query_embedding: string;
filter?: Json;
};
Returns: {
id: string;
content: string;
metadata: Json;
similarity: number;
}[];
};
match_antd_documents: {
Args: {
query_embedding: string;
filter?: Json;
};
Returns: {
id: string;
content: string;
metadata: Json;
similarity: number;
}[];
};
match_antd_knowledge: {
Args: {
query_embedding: string;
filter?: Json;
};
Returns: {
id: string;
content: string;
metadata: Json;
similarity: number;
}[];
};
match_docs: {
Args: {
query_embedding: string;
match_count?: number;
filter?: Json;
};
Returns: {
id: number;
content: string;
metadata: Json;
similarity: number;
}[];
};
match_documents: {
Args: {
query_embedding: string;
filter?: Json;
};
Returns: {
id: string;
content: string;
metadata: Json;
similarity: number;
}[];
};
match_rag_docs: {
Args: {
query_embedding: string;
filter?: Json;
};
Returns: {
id: string;
content: string;
metadata: Json;
embedding: string;
similarity: number;
}[];
};
match_embedding_docs: {
Args: {
query_embedding: string;
Expand All @@ -549,19 +475,6 @@ export type Database = {
similarity: number;
}[];
};
match_text: {
Args: {
query_embedding: string;
match_count?: number;
filter?: Json;
};
Returns: {
id: number;
content: string;
metadata: Json;
similarity: number;
}[];
};
rag_docs: {
Args: {
query_embedding: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ begin
end;
$$;

ALTER FUNCTION "public"."match_rag_docs"("query_embedding" "public"."vector", "filter" "jsonb") OWNER TO "postgres";

CREATE OR REPLACE FUNCTION "public"."match_text"("query_embedding" "public"."vector", "match_count" integer DEFAULT NULL::integer, "filter" "jsonb" DEFAULT '{}'::"jsonb") RETURNS TABLE("id" bigint, "content" "text", "metadata" "jsonb", "similarity" double precision)
LANGUAGE "plpgsql"
AS $$
Expand Down Expand Up @@ -561,10 +559,6 @@ GRANT ALL ON FUNCTION "public"."match_documents"("query_embedding" "public"."vec
GRANT ALL ON FUNCTION "public"."match_documents"("query_embedding" "public"."vector", "filter" "jsonb") TO "authenticated";
GRANT ALL ON FUNCTION "public"."match_documents"("query_embedding" "public"."vector", "filter" "jsonb") TO "service_role";

GRANT ALL ON FUNCTION "public"."match_rag_docs"("query_embedding" "public"."vector", "filter" "jsonb") TO "anon";
GRANT ALL ON FUNCTION "public"."match_rag_docs"("query_embedding" "public"."vector", "filter" "jsonb") TO "authenticated";
GRANT ALL ON FUNCTION "public"."match_rag_docs"("query_embedding" "public"."vector", "filter" "jsonb") TO "service_role";

GRANT ALL ON FUNCTION "public"."match_text"("query_embedding" "public"."vector", "match_count" integer, "filter" "jsonb") TO "anon";
GRANT ALL ON FUNCTION "public"."match_text"("query_embedding" "public"."vector", "match_count" integer, "filter" "jsonb") TO "authenticated";
GRANT ALL ON FUNCTION "public"."match_text"("query_embedding" "public"."vector", "match_count" integer, "filter" "jsonb") TO "service_role";
Expand Down
182 changes: 182 additions & 0 deletions migrations/supabase/migrations/20241015085655_remote_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
drop function if exists "public"."match_docs"(query_embedding vector, match_count integer, filter jsonb);

drop function if exists "public"."match_documents"(query_embedding vector, filter jsonb);

drop function if exists "public"."match_text"(query_embedding vector, match_count integer, filter jsonb);

create table "public"."bot_approval" (
"id" uuid not null default gen_random_uuid(),
"created_at" timestamp with time zone not null default now(),
"bot_id" character varying,
"task_type" character varying,
"approval_path" character varying,
"approval_status" character varying default ''::character varying
);


create table "public"."github_app_installations" (
"id" bigint generated by default as identity not null,
"created_at" timestamp with time zone not null default now(),
"owner_name" text,
"repo_name" text
);


create table "public"."user_rate_limit" (
"id" uuid not null default gen_random_uuid(),
"created_at" timestamp with time zone not null default now(),
"user_id" text,
"last_request" timestamp without time zone,
"request_count" bigint
);


alter table "public"."user_rate_limit" enable row level security;

alter table "public"."bots" alter column "llm" set default ''::character varying;

alter table "public"."bots" alter column "token_id" drop default;

alter table "public"."github_repo_config" add column "owner_id" character varying;

alter table "public"."github_repo_config" add column "repo_id" character varying;

CREATE UNIQUE INDEX "bot_ approval_pkey" ON public.bot_approval USING btree (id);

CREATE UNIQUE INDEX github_app_installations_pkey ON public.github_app_installations USING btree (id);

CREATE UNIQUE INDEX user_rate_limit_pkey ON public.user_rate_limit USING btree (id);

alter table "public"."bot_approval" add constraint "bot_ approval_pkey" PRIMARY KEY using index "bot_ approval_pkey";

alter table "public"."github_app_installations" add constraint "github_app_installations_pkey" PRIMARY KEY using index "github_app_installations_pkey";

alter table "public"."user_rate_limit" add constraint "user_rate_limit_pkey" PRIMARY KEY using index "user_rate_limit_pkey";

grant delete on table "public"."bot_approval" to "anon";

grant insert on table "public"."bot_approval" to "anon";

grant references on table "public"."bot_approval" to "anon";

grant select on table "public"."bot_approval" to "anon";

grant trigger on table "public"."bot_approval" to "anon";

grant truncate on table "public"."bot_approval" to "anon";

grant update on table "public"."bot_approval" to "anon";

grant delete on table "public"."bot_approval" to "authenticated";

grant insert on table "public"."bot_approval" to "authenticated";

grant references on table "public"."bot_approval" to "authenticated";

grant select on table "public"."bot_approval" to "authenticated";

grant trigger on table "public"."bot_approval" to "authenticated";

grant truncate on table "public"."bot_approval" to "authenticated";

grant update on table "public"."bot_approval" to "authenticated";

grant delete on table "public"."bot_approval" to "service_role";

grant insert on table "public"."bot_approval" to "service_role";

grant references on table "public"."bot_approval" to "service_role";

grant select on table "public"."bot_approval" to "service_role";

grant trigger on table "public"."bot_approval" to "service_role";

grant truncate on table "public"."bot_approval" to "service_role";

grant update on table "public"."bot_approval" to "service_role";

grant delete on table "public"."github_app_installations" to "anon";

grant insert on table "public"."github_app_installations" to "anon";

grant references on table "public"."github_app_installations" to "anon";

grant select on table "public"."github_app_installations" to "anon";

grant trigger on table "public"."github_app_installations" to "anon";

grant truncate on table "public"."github_app_installations" to "anon";

grant update on table "public"."github_app_installations" to "anon";

grant delete on table "public"."github_app_installations" to "authenticated";

grant insert on table "public"."github_app_installations" to "authenticated";

grant references on table "public"."github_app_installations" to "authenticated";

grant select on table "public"."github_app_installations" to "authenticated";

grant trigger on table "public"."github_app_installations" to "authenticated";

grant truncate on table "public"."github_app_installations" to "authenticated";

grant update on table "public"."github_app_installations" to "authenticated";

grant delete on table "public"."github_app_installations" to "service_role";

grant insert on table "public"."github_app_installations" to "service_role";

grant references on table "public"."github_app_installations" to "service_role";

grant select on table "public"."github_app_installations" to "service_role";

grant trigger on table "public"."github_app_installations" to "service_role";

grant truncate on table "public"."github_app_installations" to "service_role";

grant update on table "public"."github_app_installations" to "service_role";

grant delete on table "public"."user_rate_limit" to "anon";

grant insert on table "public"."user_rate_limit" to "anon";

grant references on table "public"."user_rate_limit" to "anon";

grant select on table "public"."user_rate_limit" to "anon";

grant trigger on table "public"."user_rate_limit" to "anon";

grant truncate on table "public"."user_rate_limit" to "anon";

grant update on table "public"."user_rate_limit" to "anon";

grant delete on table "public"."user_rate_limit" to "authenticated";

grant insert on table "public"."user_rate_limit" to "authenticated";

grant references on table "public"."user_rate_limit" to "authenticated";

grant select on table "public"."user_rate_limit" to "authenticated";

grant trigger on table "public"."user_rate_limit" to "authenticated";

grant truncate on table "public"."user_rate_limit" to "authenticated";

grant update on table "public"."user_rate_limit" to "authenticated";

grant delete on table "public"."user_rate_limit" to "service_role";

grant insert on table "public"."user_rate_limit" to "service_role";

grant references on table "public"."user_rate_limit" to "service_role";

grant select on table "public"."user_rate_limit" to "service_role";

grant trigger on table "public"."user_rate_limit" to "service_role";

grant truncate on table "public"."user_rate_limit" to "service_role";

grant update on table "public"."user_rate_limit" to "service_role";


Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
drop function if exists "public"."match_antd_doc"(query_embedding vector, filter jsonb);

drop function if exists "public"."match_antd_documents"(query_embedding vector, filter jsonb);

drop function if exists "public"."match_antd_knowledge"(query_embedding vector, filter jsonb);


0 comments on commit 50f0255

Please sign in to comment.