Hello community,
here is the log from the commit of package ghc-persistent-template for
openSUSE:Factory checked in at 2019-05-12 11:36:12
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-persistent-template (Old)
and /work/SRC/openSUSE:Factory/.ghc-persistent-template.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent-template"
Sun May 12 11:36:12 2019 rev:18 rq:701772 version:2.7.1
Changes:
--------
---
/work/SRC/openSUSE:Factory/ghc-persistent-template/ghc-persistent-template.changes
2019-04-28 20:13:29.582417002 +0200
+++
/work/SRC/openSUSE:Factory/.ghc-persistent-template.new.5148/ghc-persistent-template.changes
2019-05-12 11:36:14.838370263 +0200
@@ -1,0 +2,8 @@
+Tue May 7 02:03:24 UTC 2019 - [email protected]
+
+- Update persistent-template to version 2.7.1.
+ ## 2.7.1
+
+ * Add the `mkEntityDefList` function to work around
[#902](https://github.com/yesodweb/persistent/issues/902).
[#904](https://github.com/yesodweb/persistent/pull/904)
+
+-------------------------------------------------------------------
Old:
----
persistent-template-2.7.0.tar.gz
New:
----
persistent-template-2.7.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-persistent-template.spec ++++++
--- /var/tmp/diff_new_pack.E5xHNh/_old 2019-05-12 11:36:16.770375918 +0200
+++ /var/tmp/diff_new_pack.E5xHNh/_new 2019-05-12 11:36:16.770375918 +0200
@@ -19,7 +19,7 @@
%global pkg_name persistent-template
%bcond_with tests
Name: ghc-%{pkg_name}
-Version: 2.7.0
+Version: 2.7.1
Release: 0
Summary: Type-safe, non-relational, multi-backend persistence
License: MIT
++++++ persistent-template-2.7.0.tar.gz -> persistent-template-2.7.1.tar.gz
++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.7.0/ChangeLog.md
new/persistent-template-2.7.1/ChangeLog.md
--- old/persistent-template-2.7.0/ChangeLog.md 2019-04-17 21:50:18.000000000
+0200
+++ new/persistent-template-2.7.1/ChangeLog.md 2019-05-07 03:35:33.000000000
+0200
@@ -1,3 +1,7 @@
+## 2.7.1
+
+* Add the `mkEntityDefList` function to work around
[#902](https://github.com/yesodweb/persistent/issues/902).
[#904](https://github.com/yesodweb/persistent/pull/904)
+
## 2.7.0
* Depends on `persistent-2.10.0` which provides the `OnlyOneUniqueKey` and
`AtLeastOneUniqueKey` classes. Automatically generates instances for these
classes based on how many unique keys the entity definition gets. This changes
requires `UndecidableInstances` to be enabled on each module that generates
entity definitions. [#885](https://github.com/yesodweb/persistent/pull/885)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.7.0/Database/Persist/TH.hs
new/persistent-template-2.7.1/Database/Persist/TH.hs
--- old/persistent-template-2.7.0/Database/Persist/TH.hs 2019-04-16
04:46:49.000000000 +0200
+++ new/persistent-template-2.7.1/Database/Persist/TH.hs 2019-05-07
03:35:33.000000000 +0200
@@ -32,6 +32,7 @@
, mkMigrate
, mkSave
, mkDeleteCascade
+ , mkEntityDefList
, share
, derivePersistField
, derivePersistFieldJSON
@@ -1361,6 +1362,36 @@
[normalClause [VarP key] (DoE stmts)]
]
+-- | Creates a declaration for the @['EntityDef']@ from the @persistent@
+-- schema. This is necessary because the Persistent QuasiQuoter is unable
+-- to know the correct type of ID fields, and assumes that they are all
+-- Int64.
+--
+-- Provide this in the list you give to 'share', much like @'mkMigrate'@.
+--
+-- @
+-- 'share' ['mkMigrate' "migrateAll", 'mkEntityDefList' "entityDefs"] [...]
+-- @
+--
+-- @since 2.7.1
+mkEntityDefList
+ :: String
+ -- ^ The name that will be given to the 'EntityDef' list.
+ -> [EntityDef]
+ -> Q [Dec]
+mkEntityDefList entityList entityDefs = do
+ let entityListName = mkName entityList
+ edefs <- fmap ListE
+ . forM entityDefs
+ $ \(EntityDef { entityHaskell = HaskellName haskellName }) ->
+ let entityType = conT (mkName (T.unpack haskellName))
+ in [|entityDef (Proxy :: Proxy $(entityType))|]
+ typ <- [t|[EntityDef]|]
+ pure
+ [ SigD entityListName typ
+ , ValD (VarP entityListName) (NormalB edefs) []
+ ]
+
mkUniqueKeys :: EntityDef -> Q Dec
mkUniqueKeys def | entitySum def =
return $ FunD 'persistUniqueKeys [normalClause [WildP] (ListE [])]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/persistent-template-2.7.0/persistent-template.cabal
new/persistent-template-2.7.1/persistent-template.cabal
--- old/persistent-template-2.7.0/persistent-template.cabal 2019-04-15
04:27:15.000000000 +0200
+++ new/persistent-template-2.7.1/persistent-template.cabal 2019-05-07
03:35:33.000000000 +0200
@@ -1,5 +1,5 @@
name: persistent-template
-version: 2.7.0
+version: 2.7.1
license: MIT
license-file: LICENSE
author: Michael Snoyman <[email protected]>