- forM_ (xml_games m) $ \g -> do
- -- Next, we insert the home and away teams. We do this before
- -- inserting the game itself because the game has two foreign keys
- -- pointing to "teams".
- away_team_id <- insert_xml_or_select (xml_game_away_team g)
- home_team_id <- insert_xml_or_select (xml_game_home_team g)
-
- -- Now insert the game, keyed to the "odds",
- game_id <- insert_xml_fk odds_id g
-
- -- Insert a record into odds_games__teams mapping the
- -- home/away teams to this game. Use the full record syntax
- -- because the types would let us mix up the home/away teams.
- insert_ OddsGame_Team {
- ogt_odds_games_id = game_id,
- ogt_away_team_id = away_team_id,
- ogt_home_team_id = home_team_id }
-
- -- Finaly, we insert the lines. The over/under entries for this
- -- game and the lines for the casinos all wind up in the same
- -- table, odds_games_lines. We can insert the over/under entries
- -- freely with empty away/home lines:
- forM_ (xml_game_over_under_casinos g) $ \c -> do
- -- Start by inderting the casino.
- ou_casino_id <- insert_xml_or_select c
+ forM_ (xml_games m) $ \game -> do
+ -- First we insert the home and away teams.
+ away_team_id <- insert_xml_or_select (xml_away_team game)
+ home_team_id <- insert_xml_or_select (xml_home_team game)