Trigger storage delete on row delete
Hi!
I have a db table "attachments" with a "url" column, which is the local path (the path returned when uploading file) within a storage bucket called "courses".
I want a trigger with a function that, when an attachment row is deleted in the database, then it should automatically delete the file using the "url" property of the attachment. I've tried getting this to work, but have had no success. Does anyone have ideas or got this to work?
Thanks!
I have a db table "attachments" with a "url" column, which is the local path (the path returned when uploading file) within a storage bucket called "courses".
I want a trigger with a function that, when an attachment row is deleted in the database, then it should automatically delete the file using the "url" property of the attachment. I've tried getting this to work, but have had no success. Does anyone have ideas or got this to work?
Thanks!