persistent-template 1.1.2.5 → 1.1.3
raw patch · 2 files changed
+12/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Database/Persist/TH.hs +11/−1
- persistent-template.cabal +1/−1
Database/Persist/TH.hs view
@@ -98,11 +98,21 @@ -- | Create data types and appropriate 'PersistEntity' instances for the given -- 'EntityDef's. Works well with the persist quasi-quoter. mkPersist :: MkPersistSettings -> [EntityDef] -> Q [Dec]-mkPersist mps ents = do+mkPersist mps ents' = do x <- fmap mconcat $ mapM (persistFieldFromEntity mps) ents y <- fmap mconcat $ mapM (mkEntity mps) ents z <- fmap mconcat $ mapM (mkJSON mps) ents return $ mconcat [x, y, z]+ where+ ents = map fixEntityDef ents'++-- | Implement special preprocessing on EntityDef as necessary for 'mkPersist'.+-- For example, strip out any fields marked as MigrationOnly.+fixEntityDef :: EntityDef -> EntityDef+fixEntityDef ed =+ ed { entityFields = filter keepField $ entityFields ed }+ where+ keepField fd = "MigrationOnly" `notElem` fieldAttrs fd -- | Settings to be passed to the 'mkPersist' function. data MkPersistSettings = MkPersistSettings
persistent-template.cabal view
@@ -1,5 +1,5 @@ name: persistent-template-version: 1.1.2.5+version: 1.1.3 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>