Skip to content

Commit

Permalink
feat(apps/chat-with-pdf): add new migration file
Browse files Browse the repository at this point in the history
  • Loading branch information
dartilesm committed Nov 9, 2024
1 parent 1da3599 commit f4077a8
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
create extension if not exists "vector" with schema "public" version '0.7.0';

set check_function_bodies = off;

CREATE OR REPLACE FUNCTION public.remove_document_file_after_removing_chats()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
PERFORM remove_file('documents', OLD.id::text || '.pdf');

RETURN OLD;
END;
$function$
;

CREATE TRIGGER chat_delete_trigger AFTER DELETE ON public."Chat" FOR EACH ROW EXECUTE FUNCTION remove_document_file_after_removing_chats();


0 comments on commit f4077a8

Please sign in to comment.