+
+-- Team Breakdown
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreTeamBreakdown =
+ MLBBoxScoreTeamBreakdown {
+ _db_runs :: Int,
+ _db_hits :: Int,
+ _db_errors :: Int }
+ deriving ( GHC.Generic )
+
+-- | For 'H.cons' and 'H.convert'.
+--
+instance H.HVector MLBBoxScoreTeamBreakdown
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreTeamBreakdownXml =
+ MLBBoxScoreTeamBreakdownXml {
+ xml_runs_by_innings :: [MLBBoxScoreRunsByInningsXml],
+ _xml_runs :: Int,
+ _xml_hits :: Int,
+ _xml_errors :: Int }
+ deriving (Eq, GHC.Generic, Show)
+
+
+-- | For 'H.convert'.
+instance H.HVector MLBBoxScoreTeamBreakdownXml
+
+instance ToDb MLBBoxScoreTeamBreakdownXml where
+ -- | The database analogue of a 'MLBBoxScoreTeamBreakdownXml' is
+ -- a 'MLBBoxScoreTeamBreakdown'.
+ --
+ type Db MLBBoxScoreTeamBreakdownXml = MLBBoxScoreTeamBreakdown
+
+
+-- | The 'FromXml' instance for 'MLBBoxScoreTeamBreakdownXml' is
+-- required for the 'XmlImport' instance.
+--
+instance FromXml MLBBoxScoreTeamBreakdownXml where
+ -- | To convert a 'MLBBoxScoreTeamBreakdownXml' to an
+ -- 'MLBBoxScoreTeamBreakdown', we just drop the
+ -- 'xml_runs_by_innings'.
+ --
+ from_xml = H.tail
+
+instance XmlImport MLBBoxScoreTeamBreakdownXml
+
+-- Runs by innings
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreRunsByInnings =
+ MLBBoxScoreRunsByInnings {
+ _db_mlb_box_scores_team_breakdowns_id :: DefaultKey
+ MLBBoxScoreTeamBreakdown,
+ _db_runs_by_innings_inning_number :: Int,
+ _db_runs_by_innings_runs :: Int }
+ deriving ( GHC.Generic )
+
+
+-- | For 'H.cons' and 'H.convert'.
+instance H.HVector MLBBoxScoreRunsByInnings
+
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreRunsByInningsXml =
+ MLBBoxScoreRunsByInningsXml {
+ _xml_runs_by_innings_inning_number :: Int,
+ _xml_runs_by_innings_runs :: Int }
+ deriving (Eq, GHC.Generic, Show)
+
+
+-- * MLBBoxScore_MLBBoxScoreTeamSummary
+
+-- | Mapping between 'MLBBoxScore' records and
+-- 'MLBBoxScoreTeamSummary' records in the database. We don't use
+-- the names anywhere, so we let Groundhog choose them.
+--
+data MLBBoxScore_MLBBoxScoreTeamBreakdown =
+ MLBBoxScore_MLBBoxScoreTeamBreakdown
+ (DefaultKey MLBBoxScore)
+ (DefaultKey MLBBoxScoreTeamBreakdown) -- Away team
+ (DefaultKey MLBBoxScoreTeamBreakdown) -- Home team
+
+
+
+-- | For 'H.convert'.
+--
+instance H.HVector MLBBoxScoreRunsByInningsXml
+
+
+instance ToDb MLBBoxScoreRunsByInningsXml where
+ -- | The database analogue of a 'MLBBoxScoreRunsByInningsXml' is
+ -- a 'MLBBoxScoreRunsByInnings'.
+ --
+ type Db MLBBoxScoreRunsByInningsXml = MLBBoxScoreRunsByInnings
+
+
+instance Child MLBBoxScoreRunsByInningsXml where
+ -- | Each 'MLBBoxScoreRunsByInningsXml' is contained in (i.e. has a
+ -- foreign key to) a 'MLBBoxScoreTeamBreakdownXml'.
+ --
+ type Parent MLBBoxScoreRunsByInningsXml = MLBBoxScoreTeamBreakdown
+
+
+instance FromXmlFk MLBBoxScoreRunsByInningsXml where
+ -- | To convert an 'MLBBoxScoreRunsByInningsXml' to an
+ -- 'MLBBoxScoreRunsByInnings', we add the foreign key and copy
+ -- everything else verbatim.
+ --
+ from_xml_fk = H.cons
+
+
+-- | This allows us to insert the XML representation
+-- 'MLBBoxScoreRunsByInningsXml' directly.
+--
+instance XmlImportFk MLBBoxScoreRunsByInningsXml
+
+
+
+-- | The type representing \<Misc_Pitching_Stats\> XML elements. It
+-- has no associated database type; the 'xml_wild_pitches' are
+-- stored directly in the 'MLBBoxScore', and the two linked tables
+-- are treated as children of the 'MLBBoxScore'.
+--
+data MLBBoxScoreMiscPitchingStatsXml =
+ MLBBoxScoreMiscPitchingStatsXml {
+ xml_wild_pitches :: Maybe Int,
+ xml_intentional_walks :: [MLBBoxScoreMiscPitchingStatsIntentionalWalkXml],
+ xml_hits_by_pitch :: [MLBBoxScoreMiscPitchingStatsHitByPitchXml] }
+ deriving (Eq, GHC.Generic, Show)
+
+
+-- | For 'H.convert'.
+--
+instance H.HVector MLBBoxScoreMiscPitchingStatsXml
+
+
+-- * MLBBoxScoreMiscPitchingStatsIntentionalWalk
+
+-- | Database representation of an intentional walk. The weird
+-- prefixes avoid collisions with the other batter/pitcher_ids, and
+-- still get mangled properly by Groundhog.
+--
+-- The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreMiscPitchingStatsIntentionalWalk =
+ MLBBoxScoreMiscPitchingStatsIntentionalWalk {
+ _dbiw_mlb_box_scores_id :: DefaultKey MLBBoxScore,
+ _dbiw_batter_id :: Int,
+ _dbiw_pitcher_id :: Int,
+ _dbiw_number_of_times_walked :: Int }
+ deriving ( GHC.Generic )
+
+
+-- | For 'H.cons' and 'H.convert'.
+--
+instance H.HVector MLBBoxScoreMiscPitchingStatsIntentionalWalk
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreMiscPitchingStatsIntentionalWalkXml =
+ MLBBoxScoreMiscPitchingStatsIntentionalWalkXml {
+ _xml_iw_batter_id :: Int,
+ _xml_iw_pitcher_id :: Int,
+ _xml_iw_number_of_times_walked :: Int }
+ deriving (Eq, GHC.Generic, Show)
+
+-- | For 'H.convert'.
+--
+instance H.HVector MLBBoxScoreMiscPitchingStatsIntentionalWalkXml
+
+
+instance ToDb MLBBoxScoreMiscPitchingStatsIntentionalWalkXml where
+ -- | The database analogue of a
+ -- 'MLBBoxScoreMiscPitchingStatsIntentionalWalkXml' is a
+ -- 'MLBBoxScoreMiscPitchingStatsIntentionalWalk'.
+ --
+ type Db MLBBoxScoreMiscPitchingStatsIntentionalWalkXml =
+ MLBBoxScoreMiscPitchingStatsIntentionalWalk
+
+
+instance Child MLBBoxScoreMiscPitchingStatsIntentionalWalkXml where
+ -- | Each 'MLBBoxScoreMiscPitchingStatsIntentionalWalkXml' is
+ -- contained in (i.e. has a foreign key to) a 'MLBBoxScore'.
+ --
+ type Parent MLBBoxScoreMiscPitchingStatsIntentionalWalkXml =
+ MLBBoxScore
+
+
+instance FromXmlFk MLBBoxScoreMiscPitchingStatsIntentionalWalkXml where
+ -- | To convert an 'MLBBoxScoreMiscPitchingStatsIntentionalWalkXml'
+ -- to an 'MLBBoxScoreMiscPitchingStatsIntentionalWalk', we add the
+ -- foreign key and copy everything else verbatim.
+ --
+ from_xml_fk = H.cons
+
+
+-- | This allows us to insert the XML representation
+-- 'MLBBoxScoreMiscPitchingStatsIntentionalWalkXml' directly.
+--
+instance XmlImportFk MLBBoxScoreMiscPitchingStatsIntentionalWalkXml
+
+
+
+-- * MLBBoxScoreMiscPitchingStatsHitByPitchXml
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreMiscPitchingStatsHitByPitch =
+ MLBBoxScoreMiscPitchingStatsHitByPitch {
+ _dbhbp_mlb_box_scores_id :: DefaultKey MLBBoxScore,
+ _dbhbp_batter_id :: Int,
+ _dbhbp_pitcher_id :: Int,
+ _dbhbp_number_of_times_hit :: Int }
+ deriving ( GHC.Generic )
+
+-- | For 'H.cons' and 'H.convert'.
+--
+instance H.HVector MLBBoxScoreMiscPitchingStatsHitByPitch
+
+instance ToDb MLBBoxScoreMiscPitchingStatsHitByPitchXml where
+ -- | The database analogue of a
+ -- 'MLBBoxScoreMiscPitchingStatsHitByPitchXml' is a
+ -- 'MLBBoxScoreMiscPitchingStatsHitByPitch'.
+ --
+ type Db MLBBoxScoreMiscPitchingStatsHitByPitchXml =
+ MLBBoxScoreMiscPitchingStatsHitByPitch
+
+
+instance Child MLBBoxScoreMiscPitchingStatsHitByPitchXml where
+ -- | Each 'MLBBoxScoreMiscPitchingStatsHitByPitchXml' is
+ -- contained in (i.e. has a foreign key to) a 'MLBBoxScore'.
+ --
+ type Parent MLBBoxScoreMiscPitchingStatsHitByPitchXml =
+ MLBBoxScore
+
+
+instance FromXmlFk MLBBoxScoreMiscPitchingStatsHitByPitchXml where
+ -- | To convert an 'MLBBoxScoreMiscPitchingStatsHitByPitchXml'
+ -- to an 'MLBBoxScoreMiscPitchingStatsHitByPitch', we add the
+ -- foreign key and copy everything else verbatim.
+ --
+ from_xml_fk = H.cons
+
+
+-- | This allows us to insert the XML representation
+-- 'MLBBoxScoreMiscPitchingStatsHitByPitchXml' directly.
+--
+instance XmlImportFk MLBBoxScoreMiscPitchingStatsHitByPitchXml
+
+
+-- | The leading underscores prevent unused field warnings.
+--
+data MLBBoxScoreMiscPitchingStatsHitByPitchXml =
+ MLBBoxScoreMiscPitchingStatsHitByPitchXml {
+ _xml_hbp_batter_id :: Int,
+ _xml_hbp_pitcher_id :: Int,
+ _xml_hbp_number_of_times_hit :: Int }
+ deriving (Eq, GHC.Generic, Show)
+
+
+-- | For 'H.convert'.
+--
+instance H.HVector MLBBoxScoreMiscPitchingStatsHitByPitchXml
+