- 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
+ 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)
+
+ -- Now insert the game, keyed to the "odds" and its teams.
+ game_id <- insert_xml_fk_teams odds_id away_team_id home_team_id game
+
+ -- Finally, we insert the lines. The over/under entries for this