yesodweb / yesodweb/persistent

`upsertBy` does not work with a non-default Id

Open
#1,074 0 comments 1 reaction 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

The signature of upsertBy means it cannot be used by non-default Id.

Foo
    Id      Text
    name    Text
    age     Int

    UniqueName name

If we write:

upsertBy (UniqueName name) Foo
    { fooName = name
    , fooAge = 25
    }
    [ FooAge +=. 1
    ]

... then this will fail because the ID column is not specified.

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 upsertBy definition and its signature, then reproduce the provided Foo example with a non-default Id. Done means upsertBy can perform the update without requiring the default Id column to be specified.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.