November 28, 2005

Bowled Over: Design Thoughts

The good news about this mini-project is that the idea isn't that complicated. Users will choose a winner for each college football bowl game. For the four BCS games, they will also give a final score. This will be used as a means of breaking a tie and possibly some bonus points.

The bad news is there isn't a ton of time to put something together and much of the data isn't accessible via RSS or some other sort of formatted text. That's ok though since there aren't that many bowl games though some college football fans might not agree with that.

The first order of business is to create a MySQL database and some tables. At the beginning, I see four tables to hold data.

One for users which will have fields for username, password, last_login and current_score. Username and password will be VARCHAR's, last_login a datetime and the current_score a number.

There will also be a teams table which will just have the school name and the nick name. A locations table will be for the city and state information. Some cities have multiple games so we'll create a has_many relationship for that. We will also store the longitude and latitude in the locations table in case we want to do any mapping of the games.

For now, the final table will be games. We'll be storing the name of the bowl game, foreign keys to the teams table for both the home team and the away team, the time and date of the game and finally a foreign key to the locations table for the location of the game.

Undoubtedly, there will be additional tables to create but for now, these four will get us moving. The next post will look at loading the database with some initial data and using ActiveRecord outside of Rails.


Technorati Tags:


Posted by Josh at November 28, 2005 06:02 AM