Replies: 4 comments 8 replies
-
hey @Monu18765 — what have you tried? What are you trying to do? (Going to convert this to a Discussion) |
Beta Was this translation helpful? Give feedback.
-
I'm not experiencing this behavior at all. I see 1 insert when a file is uploaded. Logging via: CREATE OR REPLACE FUNCTION public.log_object_changes()
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO public.debug_logs (function_name, message, request_id)
VALUES (TG_NAME, -- Name of the trigger
'Operation: ' || TG_OP || '; ID: ' || NEW.id || '; Bucket ID: ' || COALESCE(NEW.bucket_id, '') || '; Name: ' || COALESCE(NEW.name, ''), -- Message with operation details
NEW.id); -- Assuming the request_id is the same as the object's ID for logging purposes
RETURN NEW;
END;
$$ LANGUAGE plpgsql;
CREATE TRIGGER log_inserts_on_objects
AFTER INSERT ON storage.objects
FOR EACH ROW
EXECUTE FUNCTION public.log_object_changes();
CREATE TRIGGER log_updates_on_objects
AFTER UPDATE ON storage.objects
FOR EACH ROW
EXECUTE FUNCTION public.log_object_changes(); |
Beta Was this translation helpful? Give feedback.
-
+1 |
Beta Was this translation helpful? Give feedback.
-
Wouldn't it be wise for now to only trigger if the insert operation has metadata field? |
Beta Was this translation helpful? Give feedback.
-
I could not find way to add trigger on storage objects.
Beta Was this translation helpful? Give feedback.
All reactions