I'm writing sports statistics software using Sequel which will handle 
multiple sports. With each sport comes slight variations on the database 
schema, especially with the statistics. I'm trying to find the best way to 
accommodate these differences seamlessly.

As an example, let's say I have the following structure:

DB.create_table(:leagues) do
    primary_key :id
    String :sport
end

DB.create_table(:teams) do
    primary_key :id
    foreign_key :league_id, :leagues, :key => [:id]
end

DB.create_table(:team_stats_hockey) do
    foreign_key :id, :teams, :key => [:id] 

    # hockey related stats column 

end

DB.create_table(:team_stats_football) do
    foreign_key :id, :teams, :key => [:id] 

    # football related stats column 

end


I modelled this so that it would work with the class table inheritance 
plugin, however I would like a call such as Team.first to return the 
appropriate stats object vs. just the team object. Since the teams table 
does not have the sport column available, I can't just set the plugin's key 
setting.

Is there any way I can use this plugin, but use the league's sport field as 
the key? Or should I look into writing my own plugin to handle something 
like this?

Thanks for any feedback!

- Sean

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to