X-Git-Url: https://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FTSN%2FXML%2FInjuriesDetail.hs;h=c2f189bcd0bb0189204d982a90e6e2411b7020d2;hb=32147474ba5c91452eeb532381f63e88c257a982;hp=4dda8442eca62840a55cc3ed14e51265f6eb48e2;hpb=2dd451a3963893ab2d5d6c0dd2902502bb93a05a;p=dead%2Fhtsn-import.git diff --git a/src/TSN/XML/InjuriesDetail.hs b/src/TSN/XML/InjuriesDetail.hs index 4dda844..c2f189b 100644 --- a/src/TSN/XML/InjuriesDetail.hs +++ b/src/TSN/XML/InjuriesDetail.hs @@ -27,16 +27,18 @@ where import Control.Monad ( forM_ ) import Data.Time ( UTCTime ) import Data.Tuple.Curry ( uncurryN ) -import qualified Data.Vector.HFixed as H ( HVector, cons, convert, tail ) -import qualified Data.Vector.HFixed.Cont as H (ContVec) +import qualified Data.Vector.HFixed as H ( + HVector, + asCVec, + cons, + convert, + tail ) import Database.Groundhog ( DefaultKey, countAll, deleteAll, - migrate, - runMigration, - silentMigrationLogger ) -import Database.Groundhog.Generic ( runDbConn ) + migrate ) +import Database.Groundhog.Generic ( runDbConn, runMigrationSilent ) import Database.Groundhog.Sqlite ( withSqliteConn ) import Database.Groundhog.TH ( groundhog, @@ -276,13 +278,13 @@ instance Child InjuriesDetailListingPlayerListingXml where instance FromXmlFk InjuriesDetailListingPlayerListingXml where -- | To construct a 'InjuriesDetailListingPlayerListing' from a -- 'InjuriesDetailListingPlayerListingXml' we need to supply a - -- foreign key to an 'InjuriesDetailListing'. + -- foreign key to an 'InjuriesDetailListing' after dropping the + -- '_xml_player_team_id'. -- - from_xml_fk fk = (H.cons fk) . asCont . H.tail - where - -- Should be in the library soon. - asCont :: H.ContVec a -> H.ContVec a - asCont = id + -- The 'H.asCVec' trick allows type inference to proceed in the + -- middle of two different magics. + -- + from_xml_fk fk = (H.cons fk) . H.asCVec . H.tail -- | This lets us insert the XML representation @@ -466,7 +468,7 @@ test_on_delete_cascade = testGroup "cascading delete tests" let b = undefined :: InjuriesDetailListing let c = undefined :: InjuriesDetailListingPlayerListing actual <- withSqliteConn ":memory:" $ runDbConn $ do - runMigration silentMigrationLogger $ do + runMigrationSilent $ do migrate a migrate b migrate c