packages feed

persistent 2.10.0 → 2.10.1

raw patch · 5 files changed

+20/−6 lines, 5 files

Files

ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for persistent +## 2.10.1++* Added `constraint=` attribute to allow users to specify foreign reference constraint names.+ ## 2.10.0  * Added two type classes `OnlyOneUniqueKey` and `AtLeastOneUniqueKey`. These classes are used as constraints on functions that expect a certain amount of unique keys. They are defined automatically as part of the `persistent-template`'s generation. [#885](https://github.com/yesodweb/persistent/pull/885)
Database/Persist/Class/PersistEntity.hs view
@@ -134,6 +134,12 @@ -- and the argument for the comparison. -- -- Persistent users use combinators to create these.+--+-- Note that it's important to be careful about the 'PersistFilter' that+-- you are using, if you use this directly. For example, using the 'In'+-- 'PersistFilter' requires that you have an array- or list-shaped+-- 'EntityField'. It is possible to construct values using this that will+-- create malformed runtime values. data Filter record = forall typ. PersistField typ => Filter     { filterField  :: EntityField record typ     , filterValue  :: FilterValue typ
Database/Persist/Sql/Internal.hs view
@@ -61,9 +61,13 @@             Just (resolveTableName allDefs f, refName tn c)         | otherwise = Nothing     ref _ _ ("noreference":_) = Nothing-    ref c _ (a:_)-        | Just x <- T.stripPrefix "reference=" a =-            Just (DBName x, refName tn c)+    ref c fe (a:as)+        | Just x <- T.stripPrefix "reference=" a = do+            constraintName <- snd <$> (ref c fe as)+            pure (DBName x, constraintName)+        | Just x <- T.stripPrefix "constraint=" a = do+            tableName <- fst <$> (ref c fe as)+            pure (tableName, DBName x)     ref c x (_:as) = ref c x as  refName :: DBName -> DBName -> DBName
Database/Persist/Sql/Orphan/PersistQuery.hs view
@@ -343,8 +343,8 @@                 else id)             $ connEscapeName conn $ fieldName field         qmarks = case value of-                    FilterValue{} -> "?"-                    UnsafeValue{} -> "?"+                    FilterValue{} -> "(?)"+                    UnsafeValue{} -> "(?)"                     FilterValues xs ->                         let parens a = "(" <> a <> ")"                             commas = T.intercalate ","
persistent.cabal view
@@ -1,5 +1,5 @@ name:            persistent-version:         2.10.0+version:         2.10.1 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>