Storage only or storage + table?
I'm trying to decide how I should structure my storage usage in my application.
Let's say users can create "items" and those items can have files uploaded to them.
Should I have a table that is "item_files" which contains a reference + metadata to the uploaded image in storage.
Or should I structure my storage paths in a way that allows for listing the items? Eg /uploads/{itemId}/image.png
Is there a best practice approach? To me it feels safer to have a files table as that means I can control things like metadata (uploader, tags, etc) easier. It also means that you can fetch the associated files for an item, but also display all the files that a user has ever uploaded.
Just not sure if there's pros/cons for each approach so thought I'd ask the experts!
Let's say users can create "items" and those items can have files uploaded to them.
Should I have a table that is "item_files" which contains a reference + metadata to the uploaded image in storage.
Or should I structure my storage paths in a way that allows for listing the items? Eg /uploads/{itemId}/image.png
Is there a best practice approach? To me it feels safer to have a files table as that means I can control things like metadata (uploader, tags, etc) easier. It also means that you can fetch the associated files for an item, but also display all the files that a user has ever uploaded.
Just not sure if there's pros/cons for each approach so thought I'd ask the experts!