X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FScores.hs;h=8ae86a8355e3fc24dcb1d208fe66c712b61d7868;hb=e96fc68293b6ac51eb0e8a4fe9ac9afa515cca83;hp=ef2330c6060f01686d6c1499d265c73d1f6b6fab;hpb=f131e49033be01a131234ea12a0864d6e719a520;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/Scores.hs b/src/TSN/XML/Scores.hs index ef2330c..8ae86a8 100644 --- a/src/TSN/XML/Scores.hs +++ b/src/TSN/XML/Scores.hs @@ -67,6 +67,7 @@ import TSN.DbImport ( DbImport(..), ImportResult(..), run_dbmigrate ) import TSN.Picklers ( xp_time_stamp ) import TSN.XmlImport ( XmlImport(..), XmlImportFk(..) ) import Xml ( + Child(..), FromXml(..), FromXmlFk(..), ToDb(..), @@ -128,6 +129,9 @@ instance ToDb Message where type Db Message = Score instance FromXml Message where + -- | When converting from the XML representation to the database + -- one, we drop the list of locations which will be foreign-keyed to + -- us instead. from_xml Message{..} = Score { db_xml_file_id = xml_xml_file_id, @@ -202,12 +206,15 @@ instance ToDb ScoreGameXml where -- type Db ScoreGameXml = ScoreGame -instance FromXmlFk ScoreGameXml where + +instance Child ScoreGameXml where -- | Each 'ScoreGameXml' is contained in (i.e. has a foreign key to) -- a 'Score'. -- type Parent ScoreGameXml = Score + +instance FromXmlFk ScoreGameXml where from_xml_fk fk ScoreGameXml{..} = ScoreGame { db_scores_id = fk,