In my application, I have many things that use images in different ways. For example, a product may have a logo and many screenshots, a user can have a profile image, and a company can have a logo.
I could use two different strategies a flexible tables or many tables.
Flexible tables would look like:
Images
- id
- relation_id
- related_table
- file_name
Image Meta
- id
- image_id
- key
- value
Many tables could look like:
Product Logos
- id
- file_name
- product_id
Screenshots
- id
- filename
- product_id
- display_position
Profile Images
- id
- filename
- user_id
etc.
So I'd like to know where is the balance between flexibility and normalization? or is there something I'm missing?
Thanks.