Skip to content

The duplicate entity check doesn't work transitively #1288

@parsonsmatt

Description

@parsonsmatt

So the fix in #1255 isn't quite enough. The tests in #1287 document the issue.

With the following format:

module A where
  
  mkPersist sqlSettings [persistLowerCase|
    A
      name Text
    |]

module B where

  import A
  mkPersistWith sqlSettings $(discoverEntities) [persistLowerCase|
    B
      a AId
  |]

module C where

  import B

  mkPersistWith sqlSettings $(discoverEntities) [persistLowerCase|
    C
      b BId
    |]

You'll get duplicate name errors because the mkPersistWith in C is trying to make models for A. A is not available for lookupTypeName, but it is still present in the input entity list.

Seems like it should be straightforward to just not generate things from the input list??

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions