jeremyc — 2013-05-14T11:18:11-04:00 — #1
I am having a hard time deciding on the best way to approach this problem. I am trying to set up an app in rails where users and groups of users can both upload media to albums. The media can be either images or video. I have put together a simple example ERD to show what I have so far https://docs.google.com/file/d/0B8eur28E6_TdMk9Lc0hpb1psZzg/edit?usp=sharing.
- What would be the best way to normalize this further?
- Should I separate the video and images into separate tables all together and not link them to the media table?
Any suggestions are welcome.
guido2004 — 2013-05-14T15:18:39-04:00 — #2
Why do you have separate images and videos tables? Why not add a mediatype column to the media table?
r937 — 2013-05-14T15:37:41-04:00 — #3
for medai, videos, and images, do a search for supertype/subtype
the videos and images should not have their own PKs, but rather, their PKs should be FKs to the media table
jeremyc — 2013-05-15T08:17:14-04:00 — #4
Thank you, that's what I was looking for. I love working with databases but I still have a lot to learn. Is there anyway to clean up the rest of the tables?
r937 — 2013-05-15T16:43:51-04:00 — #5
jeremyc — 2013-05-15T19:23:09-04:00 — #6
Sorry that could have been phrased better :/. Is there any way to make the schema more efficient with fewer tables. I have a tendency to make things more complicated than i need to.
r937 — 2013-05-15T22:17:48-04:00 — #7
not really... it's fine the way it is
you'll notice that the structures for groups and users are similar, and you might wonder if you could collapse them and put both users and groups into the same table (with some kind of column to tell them apart) but i would recommend against that