yesodweb / yesodweb/persistent

Provide better error message on `id` fields

Open
#1,463 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

Currently, if you define a model with an id field, like:

User
    id UUID

Then persistent fails with an unhelpful error about Multiple declarations of of 'UserId'.

While persistent should support an id column, for now, we should fail with a better error message - guiding folks towards Id.

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 tracing how persistent handles model field declarations and reports duplicate declarations for a field named id. Confirm the behavior with the User id UUID example, then make the failure message guide users toward Id; done means this case no longer emits the unhelpful Multiple declarations of 'UserId' message.

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.