quivr/backend/supabase/migrations/20240228182948_notion.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

43 lines
2.2 KiB
SQL

alter table "public"."brain_subscription_invitations" drop constraint "brain_subscription_invitations_brain_id_fkey";
alter table "public"."brains_users" drop constraint "brains_users_brain_id_fkey";
alter table "public"."brains_vectors" drop constraint "brains_vectors_brain_id_fkey";
alter table "public"."chat_history" drop constraint "chat_history_brain_id_fkey";
alter table "public"."knowledge" drop constraint "knowledge_brain_id_fkey";
alter table "public"."knowledge" drop constraint "knowledge_pkey";
drop index if exists "public"."knowledge_pkey";
alter table "public"."integrations_user" add column "last_synced" timestamp with time zone default now();
alter table "public"."brain_subscription_invitations" add constraint "brain_subscription_invitations_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."brain_subscription_invitations" validate constraint "brain_subscription_invitations_brain_id_fkey";
alter table "public"."brains_users" add constraint "brains_users_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."brains_users" validate constraint "brains_users_brain_id_fkey";
alter table "public"."brains_vectors" add constraint "brains_vectors_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."brains_vectors" validate constraint "brains_vectors_brain_id_fkey";
alter table "public"."chat_history" add constraint "chat_history_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."chat_history" validate constraint "chat_history_brain_id_fkey";
alter table "public"."knowledge" add constraint "knowledge_brain_id_fkey" FOREIGN KEY (brain_id) REFERENCES brains(brain_id) ON UPDATE CASCADE ON DELETE CASCADE not valid;
alter table "public"."knowledge" validate constraint "knowledge_brain_id_fkey";
create policy "Enable all for service role"
on "public"."integrations_user"
as permissive
for all
to service_role
with check (true);