1 {-# LANGUAGE FlexibleInstances #-}
3 {-# LANGUAGE QuasiQuotes #-}
4 {-# LANGUAGE TemplateHaskell #-}
5 {-# LANGUAGE TypeFamilies #-}
7 -- | Two different XML types have a notion of teams: "TSN.XML.Odds"
8 -- and "TSN.XML.JFile". And in fact those two types agree on the
9 -- team id, abbreviation, and name -- at least for the database
12 -- This module contains a data type for the common database
17 -- * WARNING: these are private but exported to silence warnings
22 import Database.Groundhog () -- Required for some String instance
23 import Database.Groundhog.TH (
29 -- | The database representation of a team. The 'team_id' is a
30 -- 'String' field because some teams do in fact have ids like
31 -- \"B52\". The pointless \"team_\" prefix is left on the 'team_id'
32 -- field because otherwise the auto-generated column name would
33 -- conflict with the default \"id\" primary key.
37 team_id :: String, -- ^ Some of them contain characters
38 abbreviation :: Maybe String, -- ^ Some teams don't have abbreviations,
39 -- or at least, some sample jfilexml
40 -- don't have them for some teams.
41 name :: Maybe String -- ^ Some teams don't even have names!
46 -- Generate the Groundhog code for 'Team'.
47 mkPersist defaultCodegenConfig [groundhog|
53 - name: unique_odds_games_team