homepage: https://github.com/parsonsmatt/persistent-discover#readme
changelog-type: markdown
hash: 5f887dcf572fbd147bc241f9d1a7d395bb5938c1482e6471d2bddc70db7c949f
test-bench-deps:
  base: '>=4.12 && <5'
  persistent: '>=2.13.0.0'
  hspec: -any
  filepath: -any
  dlist: -any
  mtl: -any
  file-embed: -any
  persistent-discover: -any
  hspec-discover: -any
  template-haskell: '>=2.16.0.0'
  directory: -any
maintainer: parsonsmatt@gmail.com
synopsis: Persistent module discover utilities
changelog: |
  # Changelog for persistent-discover

  ## Unreleased changes

  ## 0.1.0.0

  - Initial Release
basic-deps:
  base: '>=4.12 && <5'
  persistent: '>=2.13.0.0'
  filepath: -any
  dlist: -any
  mtl: -any
  file-embed: -any
  persistent-discover: -any
  template-haskell: '>=2.16.0.0'
  directory: -any
all-versions:
- 0.1.0.0
author: Matt Parsons
latest: 0.1.0.0
description-type: markdown
description: |
  # persistent-discover

  ![build status](https://github.com/parsonsmatt/persistent-discover/actions/workflows/haskell.yml/badge.svg)


  Supports automatic discovery of your
  [`persistent`](https://hackage.haskell.org/package/persistent) models.

  ## As an executable

  Let's say you've got a ton of `persistent` database models, all defined in a
  module hierarchy like this:

  ```
  src/
    Models/
      Foo.hs
      Bar.hs
      Baz.hs
      Blargh.hs
      What.hs
      OhNo.hs
  ```

  If you're using `persistent` to automatically generate migrations, you'll want
  to have all the `[EntityDef]` in scope from each module. You can do that by
  importing each module that defines models and calling `$(discoverEntities)`,
  introduced in `persistent-2.13`.

  But you may forget to import a module.

  This utility imports *all* the modules defined in the current directory and
  sub-directories, and then it calls `$(discoverEntities)` for you.

  To use it, place the following command in a file, located in the same directory
  that your Haskell modules are in:

  ```
  {-# OPTIONS_GHC -F -pgmF persistent-discover #-}
  ```

  Let's say we put that in `src/Models/All.hs`.
  This generates a module `Models.All` that exports a single item: `allEntities`,
  which is a `[EntityDef]` and can be used by `migrateModels` to properly perform
  migrations.

  You'll need to add `persistent-discover` to the `build-tool-depends` on your cabal file
  for this to work.
license-name: BSD-3-Clause

Update from Hackage at 2021-05-07T17:14:03Z
Update from Hackage at 2021-05-07T17:14:03Z
