yesodweb / yesodweb/persistent

Id field should not be a "reference"

Open
#1,289 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Haskell
Stars
486
Forks
306
PR merge metrics
No merged PRs in 30d

Description

A shared primary key should have a reference to the target table, not the current one.

Profile
    Id    UserId

This should have a fieldReference = FieldReference (EntityNameHS "User").

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the shared-primary-key handling that produces the field reference for the Profile/UserId example. Trace how the target entity is selected, then add or update a regression test showing that the reference points to User rather than Profile. Done means the generated field reference uses EntityNameHS "User".

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.