Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package ghc-persistent for openSUSE:Factory checked in at 2022-10-13 15:42:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-persistent (Old) and /work/SRC/openSUSE:Factory/.ghc-persistent.new.2275 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-persistent" Thu Oct 13 15:42:45 2022 rev:35 rq:1008500 version:2.14.3.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-persistent/ghc-persistent.changes 2022-08-01 21:30:34.729687427 +0200 +++ /work/SRC/openSUSE:Factory/.ghc-persistent.new.2275/ghc-persistent.changes 2022-10-13 15:42:53.710825769 +0200 @@ -1,0 +2,49 @@ +Mon Sep 12 22:00:15 UTC 2022 - Peter Simons <[email protected]> + +- Update persistent to version 2.14.3.0. + ## 2.14.3.0 + + * [#1425](https://github.com/yesodweb/persistent/pull/1425) + * Introduce an alias `setPsUseSnakeCaseForeignKeys` for + `setPsUseSnakeCaseForiegnKeys` due to a typo in the latter; + deprecate `setPsUseSnakeCaseForiegnKeys` + +------------------------------------------------------------------- +Wed Aug 24 15:43:34 UTC 2022 - Peter Simons <[email protected]> + +- Update persistent to version 2.14.2.0. + ## 2.14.2.0 + + * [#1421](https://github.com/yesodweb/persistent/pull/1421) + * Add `mpsCamelCaseCompositeKeySelector` field to `MkPersistSettings`, + which define the style of the entity's composite key. + +------------------------------------------------------------------- +Thu Aug 11 19:52:45 UTC 2022 - Peter Simons <[email protected]> + +- Update persistent to version 2.14.1.0. + ## 2.14.1.0 + + * [#1418](https://github.com/yesodweb/persistent/pull/1418/) + * Re-export `SafeToInsert` from `Database.Persist.Class`, which should + re-export it through `Database.Persist`, `Database.Persist.Sql`, etc. + * [#1409](https://github.com/yesodweb/persistent/pull/1409) + * Fix incorrect reference to rawSql in documentation. + +------------------------------------------------------------------- +Wed Jul 27 07:49:12 UTC 2022 - Peter Simons <[email protected]> + +- Update persistent to version 2.14.0.3 revision 1. + Upstream has revised the Cabal build instructions on Hackage. + +------------------------------------------------------------------- +Wed Jul 20 22:16:13 UTC 2022 - Peter Simons <[email protected]> + +- Update persistent to version 2.14.0.3. + ## 2.14.0.3 + + * [#1411](https://github.com/yesodweb/persistent/pull/1411) + * Fix the docs for `FieldNameDB`, and update `FieldDef.fieldComments` docs + since the quasiquoter *supports* field comments now. + +------------------------------------------------------------------- Old: ---- persistent-2.14.0.2.tar.gz New: ---- persistent-2.14.3.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-persistent.spec ++++++ --- /var/tmp/diff_new_pack.Wf6983/_old 2022-10-13 15:42:54.986828259 +0200 +++ /var/tmp/diff_new_pack.Wf6983/_new 2022-10-13 15:42:54.994828275 +0200 @@ -19,7 +19,7 @@ %global pkg_name persistent %bcond_with tests Name: ghc-%{pkg_name} -Version: 2.14.0.2 +Version: 2.14.3.0 Release: 0 Summary: Type-safe, multi-backend data serialization License: MIT ++++++ persistent-2.14.0.2.tar.gz -> persistent-2.14.3.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/ChangeLog.md new/persistent-2.14.3.0/ChangeLog.md --- old/persistent-2.14.0.2/ChangeLog.md 2022-06-10 17:19:09.000000000 +0200 +++ new/persistent-2.14.3.0/ChangeLog.md 2022-09-13 00:00:10.000000000 +0200 @@ -1,5 +1,32 @@ # Changelog for persistent +## 2.14.3.0 + +* [#1425](https://github.com/yesodweb/persistent/pull/1425) + * Introduce an alias `setPsUseSnakeCaseForeignKeys` for + `setPsUseSnakeCaseForiegnKeys` due to a typo in the latter; + deprecate `setPsUseSnakeCaseForiegnKeys` + +## 2.14.2.0 + +* [#1421](https://github.com/yesodweb/persistent/pull/1421) + * Add `mpsCamelCaseCompositeKeySelector` field to `MkPersistSettings`, + which define the style of the entity's composite key. + +## 2.14.1.0 + +* [#1418](https://github.com/yesodweb/persistent/pull/1418/) + * Re-export `SafeToInsert` from `Database.Persist.Class`, which should + re-export it through `Database.Persist`, `Database.Persist.Sql`, etc. +* [#1409](https://github.com/yesodweb/persistent/pull/1409) + * Fix incorrect reference to rawSql in documentation. + +## 2.14.0.3 + +* [#1411](https://github.com/yesodweb/persistent/pull/1411) + * Fix the docs for `FieldNameDB`, and update `FieldDef.fieldComments` docs + since the quasiquoter *supports* field comments now. + ## 2.14.0.2 * [#1407](https://github.com/yesodweb/persistent/pull/1407) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/Class/PersistEntity.hs new/persistent-2.14.3.0/Database/Persist/Class/PersistEntity.hs --- old/persistent-2.14.0.2/Database/Persist/Class/PersistEntity.hs 2022-05-21 03:10:47.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/Class/PersistEntity.hs 2022-08-23 01:51:59.000000000 +0200 @@ -301,8 +301,8 @@ -- migration code -- @persistent@ will expect the column to be in -- the middle, but your DBMS will put it as the last column). -- So, instead of using a query like the one above, you may use --- 'Database.Persist.GenericSql.rawSql' (from the --- "Database.Persist.GenericSql" module) with its /entity +-- 'Database.Persist.Sql.rawSql' (from the +-- "Database.Persist.Sql" module) with its /entity -- selection placeholder/ (a double question mark @??@). Using -- @rawSql@ the query above must be written as @SELECT ?? WHERE -- ..@. Then @rawSql@ will replace @??@ with the list of all diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/Class/PersistUnique.hs new/persistent-2.14.3.0/Database/Persist/Class/PersistUnique.hs --- old/persistent-2.14.0.2/Database/Persist/Class/PersistUnique.hs 2022-04-12 06:18:11.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/Class/PersistUnique.hs 2022-08-23 01:51:59.000000000 +0200 @@ -150,7 +150,7 @@ -- First, we try to explain 'upsert' using <#schema-persist-unique-1 schema-1> and <#dataset-persist-unique-1 dataset-1>. -- -- > upsertSpj :: MonadIO m => [Update User] -> ReaderT SqlBackend m (Maybe (Entity User)) - -- > upsertSpj updates = upsert (User "SPJ" 999) upadtes + -- > upsertSpj updates = upsert (User "SPJ" 999) updates -- -- > mSpjEnt <- upsertSpj [UserAge +=. 15] -- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/Class.hs new/persistent-2.14.3.0/Database/Persist/Class.hs --- old/persistent-2.14.0.2/Database/Persist/Class.hs 2022-04-12 05:39:37.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/Class.hs 2022-08-23 01:51:59.000000000 +0200 @@ -52,6 +52,7 @@ , getEntity , belongsTo , belongsToJust + , SafeToInsert , insertEntity , insertRecord diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/Names.hs new/persistent-2.14.3.0/Database/Persist/Names.hs --- old/persistent-2.14.0.2/Database/Persist/Names.hs 2021-05-05 23:10:13.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/Names.hs 2022-08-23 01:51:59.000000000 +0200 @@ -18,8 +18,8 @@ class DatabaseName a where escapeWith :: (Text -> str) -> (a -> str) --- | An 'EntityNameDB' represents the datastore-side name that @persistent@ --- will use for an entity. +-- | A 'FieldNameDB' represents the datastore-side name that @persistent@ +-- will use for a field. -- -- @since 2.12.0.0 newtype FieldNameDB = FieldNameDB { unFieldNameDB :: Text } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/Quasi.hs new/persistent-2.14.3.0/Database/Persist/Quasi.hs --- old/persistent-2.14.0.2/Database/Persist/Quasi.hs 2022-04-12 05:39:37.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/Quasi.hs 2022-09-13 00:00:10.000000000 +0200 @@ -941,9 +941,16 @@ -- between the entity name and the constraint name when -- creating a foreign key constraint name -- +-- @since 2.14.2.0 +setPsUseSnakeCaseForeignKeys :: PersistSettings -> PersistSettings +setPsUseSnakeCaseForeignKeys = setPsToFKName (toFKNameInfixed "_") + +-- Equivalent to 'setPsUseSnakeCaseForeignKeys', but misspelled. +-- -- @since 2.13.0.0 setPsUseSnakeCaseForiegnKeys :: PersistSettings -> PersistSettings -setPsUseSnakeCaseForiegnKeys = setPsToFKName (toFKNameInfixed "_") +setPsUseSnakeCaseForiegnKeys = setPsUseSnakeCaseForeignKeys +{-# DEPRECATED setPsUseSnakeCaseForiegnKeys "use the correctly spelled, equivalent, setPsUseSnakeCaseForeignKeys instead" #-} -- | Retrieve whether or not the 'PersistSettings' will generate code with -- strict fields. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/TH.hs new/persistent-2.14.3.0/Database/Persist/TH.hs --- old/persistent-2.14.0.2/Database/Persist/TH.hs 2022-06-10 17:19:09.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/TH.hs 2022-08-24 17:43:30.000000000 +0200 @@ -39,6 +39,7 @@ , mpsEntityJSON , mpsGenerateLenses , mpsDeriveInstances + , mpsCamelCaseCompositeKeySelector , EntityJSON(..) , mkPersistSettings , sqlSettings @@ -991,6 +992,33 @@ -- ^ TODO: document -- -- @since 2.13.0.0 + , mpsCamelCaseCompositeKeySelector :: Bool + -- ^ Should we generate composite key accessors in the correct CamelCase style. + -- + -- If the 'mpsCamelCaseCompositeKeySelector' value is set to 'False', + -- then the field part of the accessor starts with the lowercase. + -- This is a legacy style. + -- + -- @ + -- data Key CompanyUser = CompanyUserKey + -- { companyUserKeycompanyId :: CompanyId + -- , companyUserKeyuserId :: UserId + -- } + -- @ + -- + -- If the 'mpsCamelCaseCompositeKeySelector' value is set to 'True', + -- then field accessors are generated in CamelCase style. + -- + -- @ + -- data Key CompanyUser = CompanyUserKey + -- { companyUserKeyCompanyId :: CompanyId + -- , companyUserKeyUserId :: UserId + -- } + -- @ + + -- Default: False + -- + -- @since 2.14.2.0 } {-# DEPRECATED mpsGeneric "The mpsGeneric function adds a considerable amount of overhead and complexity to the library without bringing significant benefit. We would like to remove it. If you require this feature, please comment on the linked GitHub issue, and we'll either keep it around, or we can figure out a nicer way to solve your problem.\n\n Github: https://github.com/yesodweb/persistent/issues/1204" #-} @@ -1035,6 +1063,7 @@ , mpsDeriveInstances = [] , mpsImplicitIdDef = autoIncrementingInteger + , mpsCamelCaseCompositeKeySelector = False } -- | Use the 'SqlPersist' backend. @@ -3088,7 +3117,11 @@ | pkNewtype mps entDef = unKeyName entDef | otherwise = - mkName $ T.unpack $ lowerFirst (keyText entDef) `mappend` unFieldNameHS fieldDef + mkName $ T.unpack $ lowerFirst (keyText entDef) `mappend` fieldName + where + fieldName = modifyFieldName (unFieldNameHS fieldDef) + modifyFieldName = + if mpsCamelCaseCompositeKeySelector mps then upperFirst else id filterConName :: MkPersistSettings diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/Database/Persist/Types/Base.hs new/persistent-2.14.3.0/Database/Persist/Types/Base.hs --- old/persistent-2.14.0.2/Database/Persist/Types/Base.hs 2022-04-12 06:41:13.000000000 +0200 +++ new/persistent-2.14.3.0/Database/Persist/Types/Base.hs 2022-08-23 01:51:59.000000000 +0200 @@ -681,8 +681,7 @@ -- -- @since 2.11.0 , fieldComments :: !(Maybe Text) - -- ^ Optional comments for a 'Field'. There is not currently a way to - -- attach comments to a field in the quasiquoter. + -- ^ Optional comments for a 'Field'. -- -- @since 2.10.0 , fieldGenerated :: !(Maybe Text) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/persistent.cabal new/persistent-2.14.3.0/persistent.cabal --- old/persistent-2.14.0.2/persistent.cabal 2022-06-10 17:19:09.000000000 +0200 +++ new/persistent-2.14.3.0/persistent.cabal 2022-09-13 00:00:10.000000000 +0200 @@ -1,5 +1,5 @@ name: persistent -version: 2.14.0.2 +version: 2.14.3.0 license: MIT license-file: LICENSE author: Michael Snoyman <[email protected]> @@ -166,6 +166,7 @@ Database.Persist.PersistValueSpec Database.Persist.QuasiSpec Database.Persist.TH.CommentSpec + Database.Persist.TH.CompositeKeyStyleSpec Database.Persist.TH.DiscoverEntitiesSpec Database.Persist.TH.EmbedSpec Database.Persist.TH.ForeignRefSpec diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/test/Database/Persist/TH/CompositeKeyStyleSpec.hs new/persistent-2.14.3.0/test/Database/Persist/TH/CompositeKeyStyleSpec.hs --- old/persistent-2.14.0.2/test/Database/Persist/TH/CompositeKeyStyleSpec.hs 1970-01-01 01:00:00.000000000 +0100 +++ new/persistent-2.14.3.0/test/Database/Persist/TH/CompositeKeyStyleSpec.hs 2022-08-24 17:43:30.000000000 +0200 @@ -0,0 +1,62 @@ +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE GADTs #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE QuasiQuotes #-} +{-# LANGUAGE StandaloneDeriving #-} +{-# LANGUAGE TemplateHaskell #-} +{-# LANGUAGE UndecidableInstances #-} + +module Database.Persist.TH.CompositeKeyStyleSpec where + +import Data.Data (Data, constrFields, toConstr) +import Data.Text (Text) +import Database.Persist.Sql +import Database.Persist.TH +import Test.Hspec hiding (Selector) + +mkPersist sqlSettings + [persistLowerCase| + CompanyUserLegacyStyle + companyName Text + userName Text + Primary companyName userName + |] + +deriving instance Data CompanyUserLegacyStyle +deriving instance Data (Key CompanyUserLegacyStyle) + +mkPersist sqlSettings {mpsCamelCaseCompositeKeySelector = True} + [persistLowerCase| + CompanyUserCamelStyle + companyName Text + userName Text + Primary companyName userName + |] + +deriving instance Data CompanyUserCamelStyle +deriving instance Data (Key CompanyUserCamelStyle) + +spec :: Spec +spec = describe "CompositeKeyStyleSpec" $ do + describe "mpsCamelCaseCompositeKeySelector is False" $ do + it "Should generate Legacy style key selectors" $ do + let key = CompanyUserLegacyStyleKey "cName" "uName" + + constrFields (toConstr key) + `shouldBe` + [ "companyUserLegacyStyleKeycompanyName" + , "companyUserLegacyStyleKeyuserName" + ] + describe "mpsCamelCaseCompositeKeySelector is True" $ do + it "Should generate CamelCase style key selectors" $ do + let key = CompanyUserCamelStyleKey "cName" "uName" + + constrFields (toConstr key) + `shouldBe` + [ "companyUserCamelStyleKeyCompanyName" + , "companyUserCamelStyleKeyUserName" + ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/persistent-2.14.0.2/test/Database/Persist/THSpec.hs new/persistent-2.14.3.0/test/Database/Persist/THSpec.hs --- old/persistent-2.14.0.2/test/Database/Persist/THSpec.hs 2022-04-12 06:41:13.000000000 +0200 +++ new/persistent-2.14.3.0/test/Database/Persist/THSpec.hs 2022-08-24 17:43:30.000000000 +0200 @@ -1,10 +1,10 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} @@ -24,8 +24,6 @@ module Database.Persist.THSpec where -import System.Environment -import Data.Time import Control.Applicative (Const(..)) import Data.Aeson (decode, encode) import Data.ByteString.Lazy.Char8 () @@ -35,7 +33,9 @@ import qualified Data.List as List import Data.Proxy import Data.Text (Text, pack) +import Data.Time import GHC.Generics (Generic) +import System.Environment import Test.Hspec import Test.Hspec.QuickCheck import Test.QuickCheck.Arbitrary @@ -50,25 +50,26 @@ import qualified Database.Persist.TH.CommentSpec as CommentSpec +import qualified Database.Persist.TH.CompositeKeyStyleSpec as CompositeKeyStyleSpec import qualified Database.Persist.TH.DiscoverEntitiesSpec as DiscoverEntitiesSpec import qualified Database.Persist.TH.EmbedSpec as EmbedSpec import qualified Database.Persist.TH.ForeignRefSpec as ForeignRefSpec import qualified Database.Persist.TH.ImplicitIdColSpec as ImplicitIdColSpec import qualified Database.Persist.TH.JsonEncodingSpec as JsonEncodingSpec import qualified Database.Persist.TH.KindEntitiesSpec as KindEntitiesSpec -import qualified Database.Persist.TH.NestedSymbolsInTypeSpec as NestedSymbolsInTypeSpec import qualified Database.Persist.TH.MaybeFieldDefsSpec as MaybeFieldDefsSpec import qualified Database.Persist.TH.MigrationOnlySpec as MigrationOnlySpec import qualified Database.Persist.TH.MultiBlockSpec as MultiBlockSpec +import qualified Database.Persist.TH.NestedSymbolsInTypeSpec as NestedSymbolsInTypeSpec import qualified Database.Persist.TH.NoFieldSelectorsSpec as NoFieldSelectorsSpec import qualified Database.Persist.TH.OverloadedLabelSpec as OverloadedLabelSpec import qualified Database.Persist.TH.PersistWithSpec as PersistWithSpec import qualified Database.Persist.TH.RequireOnlyPersistImportSpec as RequireOnlyPersistImportSpec import qualified Database.Persist.TH.SharedPrimaryKeyImportedSpec as SharedPrimaryKeyImportedSpec import qualified Database.Persist.TH.SharedPrimaryKeySpec as SharedPrimaryKeySpec +import qualified Database.Persist.TH.SumSpec as SumSpec import qualified Database.Persist.TH.ToFromPersistValuesSpec as ToFromPersistValuesSpec import qualified Database.Persist.TH.TypeLitFieldDefsSpec as TypeLitFieldDefsSpec -import qualified Database.Persist.TH.SumSpec as SumSpec -- test to ensure we can have types ending in Id that don't trash the TH -- machinery @@ -198,6 +199,7 @@ ToFromPersistValuesSpec.spec JsonEncodingSpec.spec CommentSpec.spec + CompositeKeyStyleSpec.spec describe "TestDefaultKeyCol" $ do let EntityIdField FieldDef{..} = entityId (entityDef (Proxy @TestDefaultKeyCol))
