Skip to content
sterlingalexander edited this page Sep 19, 2011 · 2 revisions

My first thoughts on the design of the database. I went through the specs and I think I covered everything we need for the functions necessary. There may be some unnecessary things, such as keeping password hashes (if there is a authentication gem we can use). Also, I starred any fields that would be calculated for performance reasons (many more views of vote counts than updates would be worth the slight denormalization and upkeep).

Tables

Users

  • user_id
  • first_name
  • last_name
  • email_address
  • password_hash

Posts

  • post_id
  • post_text
  • creation_user_id (FK)
  • vote_count (*)
  • creation_date_time

Post_Votes

  • post_id (FK)
  • user_id (FK)

Reply

  • reply_id
  • post_id (FK)
  • creation_user_id (FK)
  • reply_text
  • creation_date_time
  • vote_count (*)

Reply_Votes

  • reply_id (FK)
  • user_id (FK)

Administrator

  • admin_id
  • user_id (FK)
Clone this wiki locally