quivr/backend/supabase/migrations/20240521144817_syncs-files.sql
AmineDiro ca93cb9062
refacto(backend): poetry package manager and chat route refactoring (#2684)
# Description
- Added package manager
- Added precommit checks
- Rewrote dependency injection of Services and Repositories
- Integrate async SQL alchemy engine
- Migrate Chat  repository to SQLModel 
- Migrated ChatHistory repository to SQLModel
- User SQLModel
- Unit test methodology with db rollback
- Unit tests ChatRepository
- Test ChatService get_history
- Brain entity SQL Model
- Promp SQLModel
- Rewrite chat/{chat_id}/question route
- updated docker files and docker compose in dev and production

Added `quivr_core` subpackages:
- Refactored KnowledgebrainQa
- Added Rag service to interface with non-rag dependencies

---------

Co-authored-by: aminediro <aminediro@github.com>
2024-06-26 00:58:55 -07:00

84 lines
2.9 KiB
SQL

create table "public"."syncs_files" (
"id" bigint generated by default as identity not null,
"syncs_active_id" bigint not null,
"last_modified" timestamp with time zone not null default (now() AT TIME ZONE 'utc'::text),
"brain_id" uuid default gen_random_uuid(),
"path" text not null
);
alter table "public"."syncs_files" enable row level security;
alter table "public"."syncs_active" add column "brain_id" uuid;
CREATE UNIQUE INDEX sync_files_pkey ON public.syncs_files USING btree (id);
alter table "public"."syncs_files" add constraint "sync_files_pkey" PRIMARY KEY using index "sync_files_pkey";
alter table "public"."syncs_active" add constraint "public_syncs_active_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."syncs_active" validate constraint "public_syncs_active_brain_id_fkey";
alter table "public"."syncs_files" add constraint "public_sync_files_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."syncs_files" validate constraint "public_sync_files_brain_id_fkey";
alter table "public"."syncs_files" add constraint "public_sync_files_sync_active_id_fkey" FOREIGN KEY (syncs_active_id) REFERENCES syncs_active(id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."syncs_files" validate constraint "public_sync_files_sync_active_id_fkey";
grant delete on table "public"."syncs_files" to "anon";
grant insert on table "public"."syncs_files" to "anon";
grant references on table "public"."syncs_files" to "anon";
grant select on table "public"."syncs_files" to "anon";
grant trigger on table "public"."syncs_files" to "anon";
grant truncate on table "public"."syncs_files" to "anon";
grant update on table "public"."syncs_files" to "anon";
grant delete on table "public"."syncs_files" to "authenticated";
grant insert on table "public"."syncs_files" to "authenticated";
grant references on table "public"."syncs_files" to "authenticated";
grant select on table "public"."syncs_files" to "authenticated";
grant trigger on table "public"."syncs_files" to "authenticated";
grant truncate on table "public"."syncs_files" to "authenticated";
grant update on table "public"."syncs_files" to "authenticated";
grant delete on table "public"."syncs_files" to "service_role";
grant insert on table "public"."syncs_files" to "service_role";
grant references on table "public"."syncs_files" to "service_role";
grant select on table "public"."syncs_files" to "service_role";
grant trigger on table "public"."syncs_files" to "service_role";
grant truncate on table "public"."syncs_files" to "service_role";
grant update on table "public"."syncs_files" to "service_role";
create policy "syncs_active"
on "public"."syncs_active"
as permissive
for all
to service_role;
create policy "syncs_user"
on "public"."syncs_user"
as permissive
for all
to service_role;