开发者

Database design for user medias

I am creating site where users can upload images and videos like on facebook. But I have two ideas and i wonder which is bet开发者_StackOverflow中文版ter: 1)

UserMedias{userid, mediaid...}
Medias{mediaid,mediaTypeId,name,url...}
MediaTypes{MediaTypeId,name...}

2)

UserImages{userid, imageid...}
Image{imageid,name...}
UserVideos{userid,videoid...}
Videos{videoid,name...}


First implementation has following Pros:

  • as Khez said, it will allow faster join
  • it does not require you to change schema if you want to include audio later on.

Both video and photo have same attributes other than the fact that they are physically different.


First option. Just make sure your software can handle each media type in MediaTypes table.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜