I have a very old site with spaghetti code, and I’ve decided to use CI with DataMapper to do a rewrite.
This is a sports site, with data covering multiple leagues, so I have the following structures I need to come up with
Leagues, Seasons, Teams, Conferences and Divisions
The problem I’m having is that nothing is unique to anything else, except when taken as a whole.
A season is essentially a year, so multiple leagues can have the same season.
Within each season, a team can belong to only one league, one conference and one division, but the next season, the league, conference and division might be completely different.
In addition, the multiple leagues have the same conference names and division names.
I have an existing join table from the original site
id, team_id,season_id,league_id,conference_id,division_id (plus some year specific team data)
I’m not sure how to define these relationships, or even the best way to model the data. Any suggestions would be helpful.
Just some examples, when I want to retrieve teams in a division, it needs to be league/season specific. Same for if I want to retrieve teams from a conference. For a team, I need to be able to look up it’s seasons and what league, conference and division it played in that season.