Skip to content

Commit

Permalink
Remove deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
parsonsmatt committed Apr 16, 2019
1 parent 1f20fc9 commit b398d1f
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 37 deletions.
5 changes: 5 additions & 0 deletions persistent-mongoDB/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 2.9.0

* Removed deprecated `entityToDocument`. Please use `recordToDocument` instead. [#894](https://github.com/yesodweb/persistent/pull/894)
* Removed deprecated `multiBsonEq`. Please use `anyBsonEq` instead. [#894](https://github.com/yesodweb/persistent/pull/894)

## 2.8.0

* Switch from `MonadBaseControl` to `MonadUnliftIO`
Expand Down
20 changes: 3 additions & 17 deletions persistent-mongoDB/Database/Persist/MongoDB.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module Database.Persist.MongoDB
collectionName
, docToEntityEither
, docToEntityThrow
, entityToDocument
, recordToDocument
, documentFromEntity
, toInsertDoc
Expand All @@ -43,7 +42,7 @@ module Database.Persist.MongoDB
-- ** Filters
-- $filters
, nestEq, nestNe, nestGe, nestLe, nestIn, nestNotIn
, anyEq, nestAnyEq, nestBsonEq, anyBsonEq, multiBsonEq
, anyEq, nestAnyEq, nestBsonEq, anyBsonEq
, inList, ninList
, (=~.)
-- non-operator forms of filters
Expand Down Expand Up @@ -414,7 +413,7 @@ toUniquesDoc uniq = zipWith (DB.:=)

-- | convert a PersistEntity into document fields.
-- for inserts only: nulls are ignored so they will be unset in the document.
-- 'entityToDocument' includes nulls
-- 'recordToDocument' includes nulls
toInsertDoc :: forall record. (PersistEntity record, PersistEntityBackend record ~ DB.MongoContext)
=> record -> DB.Document
toInsertDoc record = zipFilter (embeddedFields $ toEmbedEntityDef entDef)
Expand Down Expand Up @@ -459,15 +458,10 @@ recordToDocument record = zipToDoc (map fieldDB $ entityFields entity) (toPersis
where
entity = entityDef $ Just record

entityToDocument :: (PersistEntity record, PersistEntityBackend record ~ DB.MongoContext)
=> record -> DB.Document
entityToDocument = recordToDocument
{-# DEPRECATED entityToDocument "use recordToDocument" #-}

documentFromEntity :: (PersistEntity record, PersistEntityBackend record ~ DB.MongoContext)
=> Entity record -> DB.Document
documentFromEntity (Entity key record) =
keyToMongoDoc key ++ entityToDocument record
keyToMongoDoc key ++ recordToDocument record

zipToDoc :: PersistField a => [DBName] -> [a] -> [DB.Field]
zipToDoc [] _ = []
Expand Down Expand Up @@ -1339,7 +1333,6 @@ infixr 4 `nestNotIn`
infixr 4 `anyEq`
infixr 4 `nestAnyEq`
infixr 4 `nestBsonEq`
infixr 4 `multiBsonEq`
infixr 4 `anyBsonEq`

infixr 4 `nestSet`
Expand Down Expand Up @@ -1405,13 +1398,6 @@ nestAnyEq :: forall record typ.
fld `nestAnyEq` val = BackendFilter $
NestedArrayFilter fld $ PersistFilterOperator (FilterValue val) Eq

multiBsonEq :: forall record typ.
( PersistField typ
, PersistEntityBackend record ~ DB.MongoContext
) => EntityField record [typ] -> DB.Value -> Filter record
multiBsonEq = anyBsonEq
{-# DEPRECATED multiBsonEq "Please use anyBsonEq instead" #-}

-- | same as `anyEq`, but give a BSON Value
anyBsonEq :: forall record typ.
( PersistField typ
Expand Down
4 changes: 4 additions & 0 deletions persistent-mysql/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog for persistent-mysql

## 2.10.0 (unreleased)

* Remove deprecated `SomeField` type and pattern synonym. Use `HandleUpdateCollision` type instead and the `copyField` function instead of `SomeField` constructor/pattern. [#894](https://github.com/yesodweb/persistent/pull/894)

## 2.9.0

* Added support for SQL isolation levels to via SqlBackend. [#812]
Expand Down
4 changes: 2 additions & 2 deletions persistent-mysql/Database/Persist/MySQL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ insertOnDuplicateKeyUpdate record =
-- @INSERT ... ON DUPLICATE KEY UPDATE@ functionality, exposed via
-- 'insertManyOnDuplicateKeyUpdate' in this library.
--
-- @since 3.0.0
-- @since 2.8.0
data HandleUpdateCollision record where
-- | Copy the field directly from the record.
CopyField :: EntityField record typ -> HandleUpdateCollision record
Expand Down Expand Up @@ -1311,4 +1311,4 @@ putManySql' fields ent n = q
. Util.parenWrapped . Util.commaSeparated $ placeholders
, " ON DUPLICATE KEY UPDATE "
, Util.commaSeparated updates
]
]
2 changes: 1 addition & 1 deletion persistent-mysql/persistent-mysql.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: persistent-mysql
version: 2.9.0
version: 2.10.0
license: MIT
license-file: LICENSE
author: Felipe Lessa <felipe.lessa@gmail.com>, Michael Snoyman
Expand Down
3 changes: 2 additions & 1 deletion persistent-template/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## 2.7.0
## 2.7.0 (unreleased)

* 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)
* Removed deprecated `sqlOnlySettings`. Please use `sqlSettings` instead. [#894](https://github.com/yesodweb/persistent/pull/894)

## 2.6.0
* [persistent#846](https://github.com/yesodweb/persistent/pull/846): Improve error message when marshalling fails
Expand Down
8 changes: 0 additions & 8 deletions persistent-template/Database/Persist/TH.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ module Database.Persist.TH
, EntityJSON(..)
, mkPersistSettings
, sqlSettings
, sqlOnlySettings
-- * Various other TH functions
, mkMigrate
, mkSave
Expand Down Expand Up @@ -430,13 +429,6 @@ mkPersistSettings t = MkPersistSettings
sqlSettings :: MkPersistSettings
sqlSettings = mkPersistSettings $ ConT ''SqlBackend

-- | Same as 'sqlSettings'.
--
-- @since 1.1.1
sqlOnlySettings :: MkPersistSettings
sqlOnlySettings = sqlSettings
{-# DEPRECATED sqlOnlySettings "use sqlSettings" #-}

recNameNoUnderscore :: MkPersistSettings -> HaskellName -> HaskellName -> Text
recNameNoUnderscore mps dt f
| mpsPrefixFields mps = lowerFirst (unHaskellName dt) ++ upperFirst ft
Expand Down
4 changes: 3 additions & 1 deletion persistent/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Changelog for persistent

## 2.10.0
## 2.10.0 (unreleased)

* 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)
* Add the `entityComments` field to the `EntityDef` datatype, and `fieldComments` fields to the `FieldDef` datatype. The QuasiQuoter does not currently know how to add documentation comments to these types, but it can be expanded later. [#865](https://github.com/yesodweb/persistent/pull/865)
* Expose the `SqlReadT` and `SqlWriteT` constructors. [#887](https://github.com/yesodweb/persistent/pull/887)
* Remove deprecated `Connection` type synonym. Please use `SqlBackend` instead. [#894](https://github.com/yesodweb/persistent/pull/894)
* Remove deprecated `SqlPersist` type synonym. Please use `SqlPersistT` instead. [#894](https://github.com/yesodweb/persistent/pull/894)

## 2.9.2

Expand Down
7 changes: 0 additions & 7 deletions persistent/Database/Persist/Sql/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import Data.Typeable (Typeable)
import Database.Persist.Types
import Database.Persist.Sql.Types.Internal

-- | Deprecated synonym for @SqlBackend@.
type Connection = SqlBackend
{-# DEPRECATED Connection "Please use SqlBackend instead" #-}

data Column = Column
{ cName :: !DBName
, cNull :: !Bool
Expand All @@ -40,9 +36,6 @@ instance Exception PersistentSqlException

type SqlPersistT = ReaderT SqlBackend

type SqlPersist = SqlPersistT
{-# DEPRECATED SqlPersist "Please use SqlPersistT instead" #-}

type SqlPersistM = SqlPersistT (NoLoggingT (ResourceT IO))

type Sql = Text
Expand Down

0 comments on commit b398d1f

Please sign in to comment.