persistent 2.14.4.4 → 2.14.4.5
raw patch · 5 files changed
+22/−3 lines, 5 files
Files
- ChangeLog.md +8/−0
- Database/Persist/Sql/Util.hs +0/−1
- Database/Persist/TH.hs +12/−1
- persistent.cabal +1/−1
- test/Database/Persist/TH/NoFieldSelectorsSpec.hs +1/−0
ChangeLog.md view
@@ -1,5 +1,13 @@ # Changelog for persistent +## 2.14.4.5++* [#1460] https://github.com/yesodweb/persistent/pull/1468+ * Remove extraneous `map toPersistValue` call in the `mkInsertValues`+ function, as it evaluates to `id`.+* [#1476](https://github.com/yesodweb/persistent/pull/1476)+ * Fix `mkRecordName` to suffix `_` if the field name matches any of Haskell keywords.+ ## 2.14.4.4 * [#1460] https://github.com/yesodweb/persistent/pull/1460
Database/Persist/Sql/Util.hs view
@@ -243,7 +243,6 @@ mkInsertValues entity = Maybe.catMaybes . zipWith redactGeneratedCol (getEntityFields . entityDef $ Just entity)- . map toPersistValue $ toPersistFields entity where redactGeneratedCol fd pv = case fieldGenerated fd of
Database/Persist/TH.hs view
@@ -3100,7 +3100,7 @@ mkRecordName :: MkPersistSettings -> Maybe Text -> EntityNameHS -> FieldNameHS -> Name mkRecordName mps prefix entNameHS fieldNameHS =- mkName $ T.unpack $ fromMaybe "" prefix <> lowerFirst recName+ mkName $ T.unpack . avoidKeyword $ fromMaybe "" prefix <> lowerFirst recName where recName :: Text recName@@ -3114,6 +3114,17 @@ fieldNameText :: Text fieldNameText = unFieldNameHS fieldNameHS++ avoidKeyword :: Text -> Text+ avoidKeyword name = if name `Set.member` haskellKeywords then name ++ "_" else name++haskellKeywords :: Set.Set Text+haskellKeywords = Set.fromList+ ["case","class","data","default","deriving","do","else"+ ,"if","import","in","infix","infixl","infixr","instance","let","module"+ ,"newtype","of","then","type","where","_"+ ,"foreign"+ ] -- | Construct a list of TH Names for the typeclasses of an EntityDef's `entityDerives` mkEntityDefDeriveNames :: MkPersistSettings -> UnboundEntityDef -> [Name]
persistent.cabal view
@@ -1,5 +1,5 @@ name: persistent-version: 2.14.4.4+version: 2.14.4.5 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>
test/Database/Persist/TH/NoFieldSelectorsSpec.hs view
@@ -25,6 +25,7 @@ name Text Primary ident team TeamId+ type Text Team name Text