Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Database Structure advice
Old 04-05-2009, 06:33 PM Database Structure advice
CannonBallGuy's Avatar
Webmaster Talker

Posts: 618
Trades: 2
Hi all,

Basically, I want to build a php and mySQL driven CMS, possibly for use with a couple projects but mostly as a learning experience.
I'm trying to spend as much time as possible planning before I dive in. I'm thinking about database structure at the moment.
I want to allow users to post movie clips to the video section (like youtube), post images (similar the to the video section and/or in galleries) and post blog posts.
Each post (of a video, image or blog) can be a response to a previous post and all posts can be commented on and rated.

My first hurdle is regarding the structure for Posts, Responses, Comments and Ratings.
I could have separate tables for each type of Post (Blog, Video, Image, etc). Each Post record would have a ResponsePost (an ID) and a ResponseType (Blog, Video, Image, etc). Each Comment and Rating would have the same two fields. This was my very first thought but I really don't think it's a clever way of doing it.
Alternatively, one table for all Posts, each record has a PostType (Blog, Video, Image, etc) and a ResponsePost (an ID). Each Comment and Rating just refers to a PostID. This seems easier except that this one Post table has to have fields for videos, blog posts and images and for each record, 2 or these will be redundant.
I'm sure there are many other ways to do it - too many to list. Any suggestions about how to do this elegantly?
If there is some way to have the IDs for the Posts in the format: Vid0001, Vid0002, etc for Videos, Img0001, etc for Images and so-on, this would eliminate the need for the ResponseType fields while not creating the redundancy in the 2nd option.


Another small question I have is: Is it worth having a UserID if the Username is unique? Referencing the UserID should take up less space than always referencing the Username, right?


Lastly (for now! , ) I'd like to allow users to both upload and embed videos. Is it going to be a bad idea to just have the one table and store either a URL or local path (depending on if they embed or upload)? If so, what is the cleanest solution?


Thanks very much in advance. Any advice or links to good resources are really appreciated.

- CBG
CannonBallGuy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Database Structure advice
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.08106 seconds with 12 queries