MIT licensed by Michael Snoyman

Module documentation for 2.7.3

This version can be pinned in stack with:persistent-template-2.7.3@sha256:ac3e5e8c48e968b927bbf4e97162c52e7e417d69b05efeb1c581d7c682e043d2,2703


Provides Template Haskell helpers for persistent. For more information, see the chapter in the Yesod book.

code organization

The TH.hs module contains code generators. persistent-template uses EntityDefs that it gets from the quasi-quoter. The quasi-quoter is in persistent Quasi.hs Similarly mant of the types come from the persistent library


Unreleased changes


  • Update module documentation for Database.Persist.TH to better describe the purpose of the module #968
  • Support template-haskell-2.15 #959


  • Expose the knot tying logic of parseReferences so that users can build migrations from independently define entities at runtime #932


  • Add the mkEntityDefList function to work around #902. #904


  • 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
  • Removed deprecated sqlOnlySettings. Please use sqlSettings instead. #894



  • Slight improvement to the error message when a Persistent field can’t be parsed from database results


  • Exposed parseReferences to allow custom QuasiQuoters


  • Fix incorrect ToJSON/FromJSON instance generation for generic backends

Allow non-null self-references in a list

  • Allow composite Primary keys for tables that contain nullable fields.
  • Support foreign keys to non-integer ids

  • fix GHC 7.8 bug when a field name is “type”

  • fix a bad Eq instance /= definition for Key when mpsGenetric=True

  • workaround TH bug in GHC 7.10


  • read/write typeclass split


  • aeson 0.11
  • transformers 0.5


support http-api-data for url serialization

By default explicitly use Int64 for foreign key references. This avoids confusion on a 32 bit system.

Support foreign key references to composite primary keys

Support for monad-control 1.0

comments powered byDisqus